home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / doc / design.texi (.txt) < prev    next >
Texinfo Document  |  1995-05-04  |  148KB  |  2,841 lines

  1. @node Game Design, Reference Manual, Playing Xconq, About This Manual
  2. @chapter Designing Games with Xconq
  3. In this chapter, you'll learn how to design new kinds of games with
  4. @i{Xconq}.  @i{Xconq} has been designed to support the use of a variety
  5. of techniques to design, construct, and test your game idea.
  6. These techniques range from text file editing to online painting,
  7. and you will likely find a combination of techniques to be most
  8. effective.
  9. As the person customizing @i{Xconq},
  10. you will be called the @dfn{designer}.
  11. This term also indicates the primary activity, which will
  12. be to Design The Game.  The capabilities described below are merely tools;
  13. it is up to you the designer to exercise discretion and
  14. judgement in using them.
  15. Some principles of game design will be discussed in at the
  16. end of this chapter.
  17. Note that this chapter is merely an overview of game design machinery;
  18. for precise definitions, see Chapter 4.
  19. The glossary defines all the terms.
  20. You design games using @i{Xconq}'s Game Design Language (GDL).
  21. GDL is @i{Xconq}'s common language for defining all parts of a game,
  22. from the entry in the menu that players select games from,
  23. down to the last tiny detail of a saved game.
  24. GDL resembles Lisp, although (at the present time) it is not a procedural
  25. language; there are no functions or even any control constructs.
  26. Instead, the contents of a file guide the creation or modification of
  27. @i{Xconq} objects representing types, tables, units, and so forth.
  28. While a game is being played, @i{Xconq} uses this data to decide
  29. what to do and what to allow players to do.
  30. (People often have trouble with parentheses in Lisp, but if you follow
  31. the same kinds of indentation rules that you always use in
  32. C or Pascal, then you will encounter no additional trouble.
  33. Also, many editors such as Emacs are intelligent enough to indicate
  34. when parentheses match, and automatically do proper indentation.)
  35. In this chapter, ``you'' always means means you the designer,
  36. and players will be referred to as ``players'' or ``users''.
  37. The distinction is important; as the game designer, you will encounter and
  38. deal with many technical issues relating to the inner workings of @i{Xconq},
  39. but if you master those issues,
  40. your players will see only a fun game to play.
  41. A final caveat before plunging in: @i{Xconq} is an experiment in the design and
  42. construction of configurable games.  This means I have had limited
  43. prior art on which to build, and there are lots of odd corners that
  44. have never been tested or even thought about.  In this spirit, I would like
  45. to hear about weird cases, and ideas for how to handle them.
  46. @menu
  47. * Tutorial Example::
  48. * Types::
  49. * Setting up a Game::
  50. * Designing the World::
  51. * Altitudes and Elevations::
  52. * Designing the Sides::
  53. * Designing the Units::
  54. * Setup Miscellany::
  55. * Units and Actions::
  56. * Movement of Units::
  57. * Unit Construction::
  58. * Combat Actions::
  59. * Unit Manipulation::
  60. * Material Manipulation::
  61. * Terrain Manipulation::
  62. * Vision::
  63. * Backdrop Weather::
  64. * Backdrop Economy::
  65. * Random Events::
  66. * Designing the Interface::
  67. * Designing Text::
  68. * Designing the Graphics::
  69. * Game Module Organization::
  70. * Building New Games::
  71. * Debugging::
  72. * Problems and Solutions::
  73. * Optimization::
  74. * Junk to Describe Better::
  75. @end menu
  76. @node Tutorial Example, Types, Top, Game Design
  77. @section A Tutorial Example
  78. Before delving into the depths of the language,
  79. let's look at an example.
  80. Suppose you just finished watching a Godzilla movie,
  81. complete with roaring monsters, panic-stricken mobs,
  82. fire trucks putting out flames, and so forth,
  83. and were inspired to design a game around this theme.
  84. @menu
  85. * Basic Definitions::
  86. * Adding Movement::
  87. * Buildings and Rubble Piles::
  88. * Human Units::
  89. * The Scenario::
  90. @end menu
  91. @node Basic Definitions, Adding Movement, Tutorial Example, Tutorial Example
  92. @subsection Basic Definitions
  93. Start by opening up a file, calling it something like @code{g-vs-t.g},
  94. or some other name appropriate for your type of machine,
  95. and then type this into it:
  96. @example
  97. (game-module "g-vs-t"
  98.   (title "Godzilla vs Tokyo")
  99.   (blurb "Godzilla stomps on Tokyo")
  100. @end example
  101. This is a GDL @dfn{form}.
  102. It declares the name of the game to be @code{"g-vs-t"},
  103. gives it a title that prospective players will see in menus,
  104. plus a short description or @dfn{blurb}.
  105. The blurb should tell prospective players what the game is all
  106. about, perhaps whether it is simple or complex, or whether
  107. it is one-player or multi-player.
  108. Both title and blurb are examples of @dfn{properties},
  109. which are like slots in structures.
  110. The @code{game-module} form is optional but recommended;
  111. some interfaces use it to add the game to a list of games
  112. that players can choose from.
  113. The general syntax of @code{game-module} form is similar to that
  114. used by nearly all GDL forms;
  115. it amounts to a definition of an ``object'' (such as a game module or a
  116. unit type) with @dfn{properties} (such as name, description, speed, etc).
  117. Some properties are required, and appear at fixed positions,
  118. while others are optional and can be specified in any order,
  119. so they are introduced by name.  The general format, then, looks like
  120. @example
  121. (<object> ... <required properties> ...
  122.   ...
  123.   (<property name> <property value>)
  124.   ...
  125. @end example
  126. There are very few exceptions to this general syntax rule.
  127. Now the first thing you'll need is a monster.
  128. In @i{Xconq}, each unit has a type, and you define the characteristics
  129. attached to the type.
  130. @example
  131. (unit-type monster)
  132. @end example
  133. This declares a new unit type named @code{monster},
  134. but says nothing else about it.
  135. Let's use this more interesting form instead:
  136. @example
  137. (unit-type monster
  138.   (image-name "monster")
  139.   (start-with 1)
  140. @end example
  141. This shows the usual way of describing the monster.
  142. In this case, @code{image-name} is a property
  143. that specifies the name of the icon that will be used to display
  144. a monster.
  145. The property @code{start-with} says that each side should start out
  146. with one monster.  This isn't quite right, because there should only
  147. be one side with a monster, and this will give @i{each} side a monster
  148. to start out with, but we'll see how to fix that later on.
  149. We also need at least one type of terrain for the world:
  150. @example
  151. (terrain-type street (color "gray"))
  152. @end example
  153. Streets are to be gray when displayed in color, and get nothing if they
  154. are being displayed on a monochrome screen.
  155. These two forms are actually sufficient by themselves to start up a game.
  156. (Go ahead and try it.)
  157. However, you'll notice that the game is not very interesting.
  158. Although each player gets a monster, and an area consisting of all-street
  159. terrain is displayed,
  160. nobody can actually @emph{do} anything,
  161. since the defaults basically turn off all possible actions.
  162. @node Adding Movement, Buildings and Rubble Piles, Basic Definitions, Tutorial Example
  163. @subsection Adding Movement
  164. Well, that was dull.
  165. Let's give the monsters the ability to act by putting this form into
  166. the file:
  167. @example
  168. (add monster acp-per-turn 4)
  169. @end example
  170. The @code{add} form is very useful; it says to @i{modify} the existing
  171. type named @code{monster}, setting the property @code{acp-per-turn}
  172. to 4, overwriting whatever value might have been there previously.
  173. The @code{acp-per-turn} property gives the monster the ability to act,
  174. up to 4 actions in each turn.
  175. By default, the ability to act is 1-1 with the speed of the unit,
  176. so the monster can also move into a new cell 4 times each turn.
  177. If you run the game now, you will find that your monster can now get
  178. around just fine.
  179. Why 4?
  180. Actually, at this point the exact value doesn't matter,
  181. since nothing else is happening.  If the speed is 1, then the turns
  182. go faster; if the speed is 10, then they go slower and more action
  183. happens in a single turn.
  184. In a complete design however, the exact speed of each unit can be
  185. a critical design parameter, and for this game, I figured that a speed
  186. of 4 allowed a monster to cover several cells in a hurry while not
  187. being able to get too far.
  188. Also, I'm planning to make panic-stricken mobs have a speed of 1,
  189. which is the slowest possible.
  190. Making actions 1-1 with speed is usually the right thing to do,
  191. since then a player will get to move 4 times each turn
  192. (later on we will see reasons for other combinations of values).
  193. The @code{add} form works on most types of objects.  It has the
  194. general form
  195. @example
  196. (add <type(s)/object(s)> <property name> <value(s)>)
  197. @end example
  198. The type or object may be a list, in which the value is either given
  199. to all members of the list, or if it is a list itself, then the list
  200. of values is matched up with the list of types.
  201. @node Buildings and Rubble Piles, Human Units, Adding Movement, Tutorial Example
  202. @subsection Buildings and Rubble Piles
  203. To give the monster something to do besides walk around,
  204. add buildings as a new unit type:
  205. @example
  206. (unit-type building (image-name "city20"))
  207. (table independent-density (building street 500))
  208. @end example
  209. The @code{building} type uses an icon that is normally used for a
  210. 20th-century city, but it has the right look.
  211. The @code{independent-density} table says how many buildings will
  212. be scattered across in the world.
  213. The @code{table} form consists of the name of the table followed by
  214. one or several three-part lists;
  215. the two indexes into the table, and a value.  In this case, one index
  216. is a unit type @code{building}, the other is a terrain type @code{street},
  217. and the value is @code{500}, which means that we will get about 500
  218. buildings placed on a 100x100 world (look up the definition of this table
  219. in the index).
  220. You need some for testing purposes, otherwise you won't see any when you
  221. start up the game.
  222. @c In general,
  223. @c @i{Xconq} policy is not to do anything unless you've turned it on first,
  224. @c and then to give you ``reasonable'' defaults once things are turned on.
  225. We're going to let buildings default to not being able to do anything,
  226. since that seems like a reasonable behavior for buildings
  227. (although Baba Yaga's hut might be fun...).
  228. By default, buildings act strictly as obstacles; monsters cannot touch
  229. them, push them out of the way, or walk over them.
  230. In real(?) life of course, monsters hit buildings,
  231. so we have to define a sort of combat.
  232. @example
  233. (table hit-chance
  234.   (monster building 90)
  235.   (building monster 10)
  236. (table damage
  237.   (monster building 1)
  238.   (building monster 3)
  239. (add (monster building) hp-max (100 3))
  240. @end example
  241. The @code{hit-chance} and @code{damage} tables are the two basic
  242. tables defining combat.  The hit chance is simply the percent chance
  243. that an attack will succeed, while the damage is the number of hit points
  244. that will be lost in a successful attack.  The unit property @code{hp-max}
  245. is the maximum number of hit points that a unit can have, and by default,
  246. that is also what units normally start with.
  247. Note that the @code{add} form allows lists in addition to single
  248. types and values, in which case it just matches up the two lists.
  249. The @code{add} tries to be smart about this sort of thing; see its
  250. official definition for all the possibilities.
  251. The net effect of these three forms is to say that a monster has a 90%
  252. chance of hitting a building and causing 1 hp of damage;
  253. three such hits destroy the building.
  254. A monster's knuckle might occasionally be skinned doing this;
  255. a 10% chance of 3/100 hp damage is not usually dangerous,
  256. and feels a little more realistic without complicating things
  257. for the player.
  258. Now you can start up a game, and have your monster go over and
  259. bash on buildings.  Simulated wanton destruction!
  260. By default, a destroyed building vanishes, leaving only empty
  261. terrain behind.  If you want to leave an obstacle, define a new
  262. unit type and let the destroyed building turn into it:
  263. @example
  264. (unit-type rubble-pile (image-name "???"))
  265. (add building wrecked-type rubble-pile)
  266. @end example
  267. In practice, you have to be careful to define the behavior of rubble
  268. piles.  What happens when a monster hits a rubble pile?  Can the rubble
  269. pile be cleared away?  Does it affect movement?
  270. Try these things in a game now and see what happens;
  271. sometimes the behavior will be sensible, and sometimes not.
  272. For instance, you will observe that the default behavior is for
  273. the rubble pile to be an impenetrable obstacle!  The monster can't
  274. hit it, and can't stand on it, and in fact can't do anything at all.
  275. OK, let's fix it.  Monsters are agile enough to climb over all sorts
  276. of things, so the right thing is to let the monster co-occupy the
  277. cell that the rubble pile is in.  The default is to only allow one
  278. unit in a cell, but this can be changed:
  279. @example
  280. (table unit-size-in-terrain (rubble-pile t* 0))
  281. @end example
  282. This says that while all other units have a size of 1, rubble piles
  283. only have a size of 0.  By default, each terrain type has a capacity
  284. of 1, so this allows one unit and any number of rubble piles to stack
  285. together in a cell.
  286. If you try this out, you'll find that the monster can now cross over
  287. rubble piles, but still has to bash buildings in order to get them
  288. out of the way.
  289. Incidentally, it can cause problems to set a unit size to zero,
  290. because it allows infinite stacking.  Since buildings and rubble
  291. piles don't move, there will never be more than one in a cell,
  292. but @i{Xconq} will happily let hundreds of units share the same cell,
  293. which works, but causes no end of headaches for players confronted
  294. with overloaded displays.
  295. @c A game is more playable if it has at least some limits
  296. @c on stacking.  For instance, this limits stacking of rubble piles,
  297. @c and also keeps the monster out of really full-up places:
  298. @c @example
  299. @c (table unit-size-in-terrain (u* t* 1))
  300. @c (add t* unit-capacity 16)
  301. @c @end example
  302. @node Human Units, The Scenario, Buildings and Rubble Piles, Tutorial Example
  303. @subsection Human Units
  304. Now you've got an ``interactive experience'' but no game;
  305. there's no challenge or goal.
  306. You could maybe make a two-or-more-player game where the players
  307. race to see who can flatten the mostest the fastest,
  308. but that's still not too interesting to anyone past the age of 5.
  309. Instead, we need to make some units for the people bravely
  310. (or not so bravely) resisting the monster's depredations:
  311. @example
  312. (unit-type mob (name "panic-stricken mob") (image-name "mob"))
  313. (unit-type |fire truck| (image-name "firetruck"))
  314. (unit-type |national guard| (image-name "soldiers"))
  315. @end example
  316. Note that a type's name may have an embedded space, but then you have to
  317. put vertical bars around the whole symbol (a la Common Lisp).
  318. Things are starting to get complicated,
  319. so let's define some shorter synonyms:
  320. @example
  321. (define f |fire truck|)
  322. (define g |national guard|)
  323. (define humans (mob f g))
  324. @end example
  325. You can use the newly defined symbols @code{f} and @code{g}
  326. anywhere in place of the original type names.
  327. The symbol @code{humans} is a list of types, and will be useful
  328. in filling several propertys at once.
  329. As with monsters, all these new units should be able to move:
  330. @example
  331. (add humans acp-per-turn (1 6 2))
  332. @end example
  333. The speeds here are adjusted so that monsters can chase and run down
  334. (and presumably trample to smithereens) mobs and guards,
  335. but fire trucks will be able to race away.
  336. Also note the use of a three-element list that matches up with the
  337. three elements in the @code{humans} list.  This is a very useful
  338. features of GDL, and used heavily.  It can also be a problem,
  339. since if you add or remove elements from the list @code{humans},
  340. every list that it is supposed to match up with also has to change.
  341. Fortunately, @i{Xconq} will tell you if any lists do not match up
  342. because they are of different lengths.
  343. We still need to define some interaction, since monsters and humans
  344. can make faces at each other, and get in each other's way, but otherwise
  345. cannot interact.
  346. @example
  347. (add table hit-chance
  348.   (monster humans 50)
  349.   (humans monster (0 10 70))
  350. @end example
  351. This time we have to say ``add table'' because we've already defined
  352. the @code{hit-chance} table and now just want to augment it.
  353. As with the addition of properties, we can use a list in place of
  354. a single type.
  355. Last but not least, we need a scorekeeper to say how winning and losing
  356. will happen.  This is a simple(-minded?) game, so a standard type will
  357. be sufficient:
  358. @example
  359. (scorekeeper (do last-side-wins))
  360. @end example
  361. The @code{do} property of a scorekeeper may include some rather elaborate
  362. tests, but all we want to is to say that the last side left standing
  363. should be the winner, and the symbol @code{last-side-wins} does just that.
  364. There might be a bit of a problem with this in practice, since in order
  365. to win, the monster has to stomp on all the humans, including fire trucks.
  366. But fire trucks can always outrun the monster, and cannot attack it
  367. directly either, which leads to a stalemate.
  368. You can fix this by zeroing the point value of fire trucks:
  369. @example
  370. (add f point-value 0)
  371. @end example
  372. Now, when all the mobs and guards have been stomped, the monster wins
  373. automatically, no matter how many fire trucks are left.
  374. @node The Scenario, , Human Units, Tutorial Example
  375. @subsection The Scenario
  376. As it now stands, your game design requires @i{Xconq}
  377. to generate all kinds of stuff randomly,
  378. such as the initial set of units, terrain, and so forth.
  379. However, we @emph{are} doing a monster movie, so random combinations
  380. of monsters and people and terrain don't usually make sense.
  381. Instead of trying to define a ``reasonable'' random setup,
  382. we should define a scenario, either by starting a random
  383. game, modifying, and saving it, or by text editing.
  384. Since online scenario creation is hard to describe in the manual,
  385. let's do it with GDL instead.
  386. To define a scenario, we generally need three things:
  387. sides, units, and terrain.
  388. Now the basic monster movie idea puts one monster up against
  389. a bunch of people acting together, so that suggests two sides:
  390. @example
  391. (side 1)
  392. (side 2 (name "Tokyo") (adjective "Japanese"))
  393. @end example
  394. The @code{1} and @code{2} identify the two sides uniquely,
  395. since we'll have to match units up with them in a moment.
  396. The side that plays the monster is really a convenience;
  397. players should just be aware of the one monster unit,
  398. so we don't need any sort of names.
  399. The other side has many units, which should be qualified
  400. as @code{"Japanese"}, and the side as a whole really represents
  401. the city of Tokyo, so use that for the side's name.
  402. Now for the units:
  403. @example
  404. (unit monster (s 1) (n "Godzilla"))
  405. (unit firetruck (s 2))
  406. (unit firetruck (s 2))
  407. (building 9 10 2)
  408. (define b building)  ; abbreviate for compactness' sake
  409. (b 10 10 2)
  410. (b 11 10 2 (n "K-Mart"))
  411. (b 12 12 2 (n "Tokyo Hilton"))
  412. (b 13 12 2 (n "Hideyoshi's Rice Farm"))
  413. (b 14 12 2 (n "Apple Japan"))
  414. ;; ... need lots of buildings ...
  415. @end example
  416. This example shows two syntaxes for defining units:
  417. the first is introduced by the symbol @code{unit} and
  418. requires only a unit type (or an id, see the definition in xxx),
  419. while the second is introduced by
  420. the unit type name itself and requires a position and side.
  421. The second form is more compact and thus suitable for setting up large
  422. numbers of units, while the first form is more flexible, and can be used
  423. to modify an already-created unit.  In both cases, the required data
  424. may be followed by optional properties in the usual way.
  425. Also, since the word ``building'' is a little longwinded,
  426. I defined the symbol ``b'' to evaluate to ``building''.
  427. GDL has very few predefined variables,
  428. so you can use almost anything, including weird stuff like
  429. ``&'' and ``=''.
  430. Property names like @code{s} and @code{n} are NOT predefined
  431. variables, so you can use those too if you like.
  432. At this point, you should have a basic game scenario,
  433. with one player being Godzilla, and the other trying to
  434. keep it from running amuck and flattening all of Tokyo.
  435. Have fun!
  436. You can enhance this scenario in all kinds of ways,
  437. depending on how ambitious you want to get.
  438. Given the basic silliness of the premise, though,
  439. it would be more worthwhile to enhance the silliness
  440. and speed up the pace, rather than to add features and details.
  441. For instance, name the buildings after all the laughingstock
  442. places you know of in your own town.
  443. To see where you could go with this, look at the library's @code{monster}
  444. game and its @code{tokyo} scenario, which include fires, different kinds
  445. of terrain, and other goodies.
  446. @node Types, Setting up a Game, Tutorial Example, Game Design
  447. @section Types
  448. Types are the foundation of all @i{Xconq} game designs.
  449. Types are like classes in object-oriented programming but simpler;
  450. each set of types is fixed and used only in a particular way by @i{Xconq}.
  451. A game design defines types of units, materials, and terrain.
  452. Only materials are optional; every game design must define at
  453. least one unit type and one terrain type.
  454. Types in GDL are simple compared to most other languages.
  455. There is no inheritance, no subtyping, no coercions or conversions.
  456. This is not a real limitation, since game designs are usually too
  457. small to make effective use of any sort of inheritance.
  458. Also, game design is an exacting activity;
  459. inheritance is often difficult to control satisfactorily.
  460. You can use lists of types to simulate inheritance as necessary;
  461. this is actually more flexible, because you can have any
  462. number of lists with any set of types in each.
  463. It may not seem as efficient, but GDL is only used during
  464. startup, and is almost entirely array- and struct-based during
  465. the game.  (A few places, such as scorekeeping, examine GDL forms
  466. during play.)
  467. Types are defined one at a time in the game module file.
  468. Each type gets an index from 0 on up, in order of the type's
  469. appearance in the file.  Although this is not normally visible
  470. to you or to the player, some error messages and other places
  471. will make reference to raw type indices.
  472. Each category of type - unit, material, and terrain
  473. is indexed individually.
  474. @menu
  475. * Unit Types::
  476. * Terrain Types::
  477. * Material Types::
  478. * Type Relationships::
  479. * Stacking::
  480. * Occupants and Transports::
  481. * Hints on Types::
  482. @end menu
  483. @node Unit Types, Terrain Types, Types, Types
  484. @subsection Unit Types
  485. Unit types define what the players get to play with.
  486. Unit types can include almost anything; people, buildings, airplanes,
  487. monsters, arrows, boulders, you name it.
  488. The basic form of a unit type definition is so:
  489. @example
  490. (unit-type @var{type-name} (@var{property-name} @var{property-value}) @dots{})
  491. @end example
  492. The appearance of this form in a file means you are adding a new and
  493. distinct type, which has no relation to any other types defined before
  494. and after this one.  The @var{type-name} must be a unique symbol,
  495. such as @code{building} or @code{|fire truck|}. (Note that you can set
  496. things up so that players never see the @var{type-name} anywhere,
  497. so don't worry if your preferred name conflicts with something else,
  498. just choose another name.)
  499. The @var{property-name} and @var{property-value} pairs are entirely optional.
  500. They can always be defined or changed later in the file.
  501. There is little advantage one way or another.
  502. This particular syntax - keyword followed by name or other identifier
  503. followed by property/value pairs - will be used for most GDL definitions.
  504. The number of unit types is limited.  The exact limit depends on the
  505. implementation, but is guaranteed to be at least 127.
  506. This is a huge number of types
  507. in practice; the only situations where this might be needed would be
  508. a fantasy-type game with many types of items and monsters.
  509. For empire-building games, 8-16 unit types is far more reasonable.
  510. Keep in mind that with lots of types, players have more to keep track of,
  511. internal data structures will be larger and take longer to work with,
  512. and designing the game will take more time and energy.
  513. Consider also that @i{Xconq} gives you a lot of properties
  514. that you can set individually for each unit type,
  515. so that when other game systems might require a distinct types, @i{Xconq}
  516. lets you use the same type with different propertys.
  517. For instance, in a fantasy
  518. game you wouldn't need to define ``young dragons'' and ``old dragons'' as
  519. distinct types, instead you can vary the hit points or experience of
  520. a generic ``dragon'' type.
  521. @node Terrain Types, Material Types, Unit Types, Types
  522. @subsection Terrain Types
  523. Each cell in the world has a terrain type.  This type should be thought
  524. of as the predominant contents of the cell, whether it be open ground,
  525. forest, city streets, or the vacuum of deep space.
  526. The type can be anything
  527. you want, and should be adapted to fit the game you're designing.
  528. Sure, the real world has swamps, but if you're designing a game set
  529. in the Sahara, don't bother defining a swamp terrain type.
  530. Also, the type doesn't carry any preconceptions about elevation
  531. or climate, so you can have swamps at 20,000 feet just as easily
  532. as at sea level.
  533. The limit on the number of terrain types is large
  534. (up to about 127, depending on the implementation),
  535. but in practice, 6-10 types offer variety without being confusing.
  536. Ideally, several of those types will be uncommon in the world,
  537. so that map displays will consist mostly of 3-4 types of terrain.
  538. Some game designs involve entities that are very large and do not move around.
  539. Such entities could plausibly be represented either as non-moving units or as a
  540. distinct terrain type.  To make the right choice, you need to consider the
  541. special characteristics you want to implement.  Terrain cannot (usually)
  542. be changed during the game, nor can it be moved, but units can be damaged
  543. or belong to different sides.  A realistic example of this choice occurs
  544. in the monster game - should a destroyed building become a ``rubble-pile''
  545. unit or should the building stand on rubble-pile terrain and vanish when
  546. it is destroyed?  Both choices are plausible; if the rubble-pile is a unit,
  547. then the original building is then on top of an empty city block, and after
  548. the building is destroyed, the rubble-pile unit can itself be cleaned off,
  549. exposing the empty city block again.  However, you have to decide whether
  550. the rubble-pile unit belongs to a side, how it interacts with other units,
  551. and so forth.  Rubble-pile terrain is simpler, but the players then get
  552. descriptions of brand-new buildings sitting in the midst of rubble-piles,
  553. which is confusing.  This is a case where there is no ``right'' answer.
  554. @node Material Types, Type Relationships, Terrain Types, Types
  555. @subsection Material Types
  556. Material types are the simplest to define.  They have only a few properties
  557. of their own; most of the time they just index tables along with the
  558. other types.
  559. Materials do not act on their own in any way; instead, players
  560. manipulate materials as part of doing other actions.
  561. For instance, you can specify that movement, combat, and even a
  562. unit's very survival depends on having a supply of some material,
  563. or that some material is ammo and consumed gradually when fighting.
  564. The use of materials is pretty much up to you.  You don't have to
  565. define any material types at all,
  566. and game designs with materials are usually more complicated.
  567. However, the increase in realism is often worth it;
  568. with materials you can limit player activity
  569. and/or make some actions more ``expensive'' than others.
  570. As with the other types, you can define up to about 127 material types,
  571. but that would be enough to model the entire global economy
  572. accurately! (and take all week to compute a single turn...)
  573. 1-3 types is reasonable.
  574. @node Type Relationships, Stacking, Material Types, Types
  575. @subsection Static Relationships Between Types
  576. The next sections describe the ``static'' relationships between types of
  577. objects, meaning those relations which must always hold, both in the
  578. initial setup and throughout a game.
  579. @node Stacking, Occupants and Transports, Type Relationships, Types
  580. @subsection Stacking
  581. By default, @i{Xconq} allows only one unit in each cell at a time.
  582. This has the advantage of simplicity, but also makes some bizarre
  583. situations, such as the ability of a merchant ship to prevent an
  584. airplane from passing overhead or a submarine from passing underneath.
  585. To fix this, you can allow players to stack several units in the
  586. same cell.  This is governed by several tables, which give you control
  587. over which and how many of each type can stack together in which kinds
  588. of terrain.  The basic idea is that a cell has a certain amount of room
  589. for units, as specified by the terrain type property @code{capacity},
  590. and each unit has a certain size in the cell, according to the table
  591. @code{unit-size-in-terrain}.
  592. @example
  593. (add (plains canyons) capacity (10 2))
  594. (table unit-size-in-terrain
  595.   ((indians town) plains (1 5))
  596.   ((indians town) canyons (1 2))
  597. @end example
  598. In this example, a player can fit 10 indians or 2 towns into a plains cell,
  599. or else one town and 5 indians, while canyons allow only 2 indians or one town.
  600. In addition, some unit types may be able to count on a terrain type providing
  601. a guaranteed place; for this, you can use the unit/terrain table
  602. @code{terrain-capacity-x}.  This table (which defaults to 0) allows
  603. the specified number of units of each type to be in each type of
  604. terrain, irrespective of who else is there.  For instance,
  605. a space station could be given space via
  606. @example
  607. (table terrain-capacity-x (space-station t* 10000))
  608. @end example
  609. So while units on the ground are piling together and being constrained
  610. by capacity, space stations overhead can stack together freely (space
  611. is pretty big, after all).
  612. @node Occupants and Transports, Hints on Types, Stacking, Types
  613. @subsection Occupants and Transports
  614. Occupants and transports work similarly to stacking in terrain;
  615. there is both a specialized capacity and a generic capacity that
  616. units' sizes count against.
  617. @example
  618. (add (transport carrier) capacity (8 4))
  619. (table unit-size-as-occupant
  620.   ((infantry armor) transport (1 2))
  621.   ((fighter bomber) carrier (1 4))
  622. (table unit-capacity-x
  623.   (carrier fighter 4)
  624. @end example
  625. It may be that all the different sizes interact so that you can't
  626. prevent huge numbers of small units being able to occupy a single
  627. transport.  To fix this, use @code{occupants-max}.
  628. Transport is a physical relationship, so for instance one cannot use
  629. transports to define a convoy whose acp-per-turn is determined by its
  630. slowest member.  (This doesn't mean you can't define a convoy
  631. type, but you will have to pick an arbitrary speed for it.)
  632. Watch out for unexpected side effects of setting the @code{capacity}
  633. but not the @code{unit-size-as-occupant}!  Since @code{unit-size-as-occupant}
  634. defaults to 1, then a unit with a nonzero capacity can by default
  635. take on @i{any} other type as an occupant!
  636. Also, don't let units carry others of their own type.
  637. Not only is this of doubtful meaning,
  638. @i{Xconq} is not guaranteed to cope well with this situation,
  639. since it allows infinite recursion in the occupant-transport relation.
  640. Ditto for loops; ``A can carry B which can carry C which can carry A''.
  641. @node Hints on Types, , Occupants and Transports, Types
  642. @subsection Hints on Types
  643. It is tempting to try to define independent sets of types,
  644. each in a separate module, and glue them together somehow.
  645. However, this doesn't work well in practice, because in a game,
  646. the types interact in unexpected ways.
  647. Suppose, for example, that you define a set of airplane types that
  648. you want to be generic enough to use with several different games.
  649. The assessment of those types may vary drastically from game to game;
  650. in one, airplanes are 100 times faster than any other sort of unit,
  651. so that moving airplanes takes up 99% of game play, while in another,
  652. the same set of airplane types are too weak to be of any interest to
  653. players.
  654. There is a standard set of terrain types called @code{"stdterr"}.
  655. This set has a mix of the types found most useful for ``Empire-type'' games,
  656. and Earth-like percentages for random world generation.
  657. @node Setting up a Game, Designing the World, Types, Game Design
  658. @section Setting up a Game
  659. You have a spectrum of options for how @i{Xconq} will set up a game
  660. based on your design.  At the one end, you can build a scenario that
  661. specifies everything exactly, down to the last unit.  Lest you think
  662. this is too restrictive to be interesting, consider that this is
  663. how chess works...
  664. At the other end of the spectrum,
  665. you can let @i{Xconq} manufacture everything,
  666. starting only with a handful of numbers that you supply.
  667. The next several sections describe the alternatives available for
  668. game setup.  It is important to understand what is possible,
  669. because in general the character of an @i{Xconq} game will depend
  670. strongly on the initial setup, and players will be very angry
  671. (with you!) if they discover, several hours into a hard-fought game,
  672. that they've been given a grossly unfair starting position.
  673. @node Designing the World, Altitudes and Elevations, Setting up a Game, Game Design
  674. @section Designing the World
  675. The @i{Xconq} world/area is a two-dimensional grid of fixed shape and size.
  676. You can treat it as representing part of a planet in space,
  677. and set up parameters simulating that,
  678. or just make it be itself and not address the question
  679. of the surrounding context.  The appropriate choice depends on how much
  680. realism and complexity you need.  Most computer games don't bother with
  681. this detail; for instance, a game set in an underground dungeon doesn't
  682. usually need to compute daylight, weather, or seasons.  However, these
  683. same details may be very useful for games set outdoors.
  684. @menu
  685. * World Shape and Size::
  686. * World Terrain::
  687. * Synthesizing World Terrain::
  688. * Rivers::
  689. * Roads::
  690. @end menu
  691. @node World Shape and Size, World Terrain, Designing the World, Designing the World
  692. @subsection World Shape and Size
  693. Once you've decided whether the area is to be part of a planet or not,
  694. you can address the question of size and shape.
  695. You have two choices for shape: hexagon and cylinder.
  696. (See the players chapter for pictures of these.)
  697. The important thing for you as a designer is that the cylinder
  698. wraps around, while the hexagon is bounded on all sides.
  699. One consequence is that games involving pursuit will be quite
  700. different; on a cylinder, the chase can go 'round and 'round forever,
  701. while on a hexagon, a fleeing unit could be cornered.
  702. Cylinders have a disadvantage in that there is no obvious ``starting place''
  703. for coordinates, scrolling, etc, so there is a navigation and orientation
  704. problem for players, especially if the world is randomly generated and not
  705. the familiar continents of the Earth.  In fact, players will often not
  706. even realize that a world is a cylinder and will assume that the edge
  707. of the display is the edge of the world!  To make a cylindrical area,
  708. set the circumference of the world equal
  709. to the width of the area.  Otherwise, the area will be handled as a hexagon.
  710. You can choose either to set a fixed size using the @code{area} form,
  711. or allow players to set the actual size via the @code{world-size} variant,
  712. in which case you can define the allowable range of sizes.
  713. Worlds need not be really large.  Larger worlds are harder for
  714. players to manage, they take longer to display, and can consume
  715. prodigious amounts of memory (since they are represented as arrays
  716. internally, for speed).  The ideal range of sizes depends primarily
  717. on the size and speed of units.  A 60x60 area in a game with units whose
  718. speed is 1 means that they will take 60 turns to cross, while units with
  719. a speed of 20 take only 3 turns, so they make the world ``feel smaller''.
  720. As another example, in the standard game,
  721. a 20x20 area allows player to come to grips quickly, but it also
  722. means that each player's units might be within attack range right
  723. from the outset, which has a drastic effect on strategy.
  724. For exploration-oriented games, larger worlds are more interesting.
  725. @node World Terrain, Synthesizing World Terrain, World Shape and Size, Designing the World
  726. @subsection World Terrain
  727. The best technique for designing the terrain of a world is
  728. to use the designer tools provided with @i{Xconq}.
  729. The details of how these tools work depends on the interface,
  730. but in general they resemble the tools found in paint programs.
  731. Some interfaces also give you the option of rescaling the map,
  732. so that you can fine-tune the size and positioning of the terrain.
  733. Another technique is to write a program that translates data from another
  734. source (such as NASA satellite data) into @i{Xconq} format.
  735. However, if you take a rectangular array of data and just wrap an
  736. @code{area (terrain ...))} form around it,
  737. then everything will appear to be tilting to the left.
  738. To fix this, have your program map the cell at @code{x, y}
  739. in the rectangular array to @code{x - y / 2, y} before writing.
  740. You must discard values whose new @code{x} coordinate is negative,
  741. or else wrap them around to the right side of the area, although
  742. that is usually only reasonable for cylindrical areas.
  743. The crudest technique is to try to build terrain by using a text editor.
  744. The coordinate system is Cartesian oblique, with the y axis tilted to form
  745. a 60-degree angle with the x axis, so it can be difficult to relate
  746. typed-in characters to the final appearance.  Landforms in the file should
  747. appear to be leaning to the left, if they are to appear upright during play.
  748. However, sometimes text editing is necessary, for instance when you need
  749. to change every instance of a terrain type to something else.
  750. (Incidentally, some of the large real-world maps in the library
  751. were produced by coding all the terrain types from an atlas onto
  752. graph paper, typing them in, then fixing the tilt as described above.)
  753. Incidentally, areas should have some distinguishing terrain
  754. around the edges; this prevents player confusion that sometimes
  755. happens when there is no other clue as to where the edge might be.
  756. However, this is not enforced by @i{Xconq}, and you can put
  757. whatever you like along the edges.
  758. Randomly generated worlds normally use the value of 
  759. the global variable @code{edge-terrain}.
  760. @node Synthesizing World Terrain, Rivers, World Terrain, Designing the World
  761. @subsection Synthesizing World Terrain
  762. The random way to get terrain for a world is to use one of several
  763. synthesis methods built into @i{Xconq}.
  764. Totally random terrain is available via the synthesis method
  765. @code{make-random-terrain}.  This just randomly chooses a terrain
  766. type for each cell, using the weights in the @code{occurrence}
  767. property of each type.  An @code{occurrence} of 0 means that the
  768. type will never be placed anywhere.
  769. This method produces a sort of speckly-looking world,
  770. and is better for testing than for actual play.  Still, if you have
  771. two types @code{vacuum} and @code{solar-system}, then a form like
  772. @example
  773. (add (vacuum solar-system) occurrence (20 1))
  774. @end example
  775. will give you a nice starfield for a space game.
  776. The fractal world method @code{make-fractal-percentile-terrain}
  777. descends from the most venerable part of @i{Xconq}
  778. (it was once a piece of Atari Basic code).  It uses a fractal algorithm
  779. along with percentile-based terrain classification to make realistic-looking
  780. worlds with terrain and elevations.
  781. To use this method, you first specify how many, what size, and what height
  782. of blobs to splash onto the world,
  783. and how many times to average cells with their
  784. neighbors.  Then you specify the subdivision of all the possible altitudes
  785. and moisture levels into different kinds of terrain.
  786. For instance, desert in the standard terrain ranges from
  787. sea level (@code{alt-percentile-min} = 70%)
  788. to high elevations (@code{alt-percentile-max} = 93%) but only
  789. in the lowest percentiles of moisture (@code{wet-percentile-min} = 0%,
  790. @code{wet-percentile-max} = 20%).
  791. It is important that all percentiles be assigned
  792. to some terrain type, or the map generator will complain and subsitute
  793. terrain type 0 (the first-defined type); when designing
  794. terrain percentiles, it is helpful to make a chart with altitude percentiles
  795. 0-100 on one axis and moisture percentiles on the other.
  796. Note that overlapping on this chart is OK, and the terrain generator
  797. will pick the lowest-numbered terrain.
  798. Also note that you don't have to include every terrain type.
  799. The @code{alt} numbers are also used to compute elevations
  800. for games that need them, but the @code{wet} numbers need
  801. not have anything to do
  802. with water at all; they could just as easily represent smog levels or
  803. vegetation densities.
  804. If you only want to use one of the two layers, just set the percentiles
  805. for the other to be 0 - 100 for all terrain types.
  806. [should have an example]
  807. The method @code{make-maze-terrain} produces a maze consisting
  808. of a mix of ``solid'', ``passageway'', and ``room'' terrain.
  809. It uses the @code{maze-room-density} and @code{maze-passage-density}
  810. properties of each terrain type to decide
  811. how much of each to use for rooms and passages.
  812. The method first does random terrain generation, using the
  813. @code{occurrence} property to decide how much of each terrain
  814. to put down (remember that @code{occurrence} defaults to 1 for
  815. all terrain types).
  816. Then it carves out rooms, and passageways between them.
  817. The passages and rooms are guaranteed to be completely connected.
  818. The method @code{make-earth-like-terrain} attempts
  819. to model the natural processes and generate terrain as similar as possible
  820. to what is observed on Earth today.
  821. You should note that at least one method for synthesizing terrain must be
  822. available, unless you can guarantee that terrain will be loaded from a
  823. file.  The following subsections describe optional additional synthesis
  824. methods that you can include.
  825. @node Rivers, Roads, Synthesizing World Terrain, Designing the World
  826. @subsection Rivers
  827. You can use the @code{make-rivers} method to add rivers to the world.
  828. Rivers are basically water features that depend on terrain elevations,
  829. so they won't be generated unless both a river terrain type (either
  830. border or connection) and elevation data is available.
  831. You get them by specifying a nonzero chance for some type of
  832. terrain to be the location of a headwater (@code{river-chance}).
  833. @i{Xconq} doesn't have any intuition about the behavior of water;
  834. it will happily trace rivers all the the way down to the bottom of the sea.
  835. Use the @code{liquid} property to tell @code{make-rivers}
  836. what types that rivers cannot touch.
  837. The method still traces the river's course, and resumes modifying
  838. terrain when possible, which means that the river can appear
  839. as both the inlet and outlet from a lake.
  840. @node Roads, , Rivers, Designing the World
  841. @subsection Roads
  842. The @code{make-roads} method is a fairly generic method.
  843. It just picks pairs of units randomly and runs a road between them,
  844. attempting to share road segments and route through favorable terrain.
  845. Although simplistic, the results look pretty good.
  846. You can make short bridges by tweaking the road density
  847. appropriately.  Just allow roads from land to water, and water to land,
  848. but not from water to water.
  849. Note that this method is only useful if there are actually units
  850. for the roads to connect.
  851. @subsection Independent Units
  852. For many games, it is useful to have independent units scattered randomly
  853. across the world.  For instance, gold mines and treasure hoards would be
  854. good for an exploration game, and independent castles for a medieval game.
  855. You can set this up with the @code{make-independent-units} method.
  856. @node Altitudes and Elevations, Designing the Sides, Designing the World, Game Design
  857. @section Altitudes and Elevations
  858. @i{Xconq} is basically a 2-dimensional game,
  859. but you can emulate a third dimension by defining elevations for terrain
  860. and altitudes for units above and below the terrain.
  861. The main use of altitudes is to control interactions between certain kinds of
  862. units, particularly aircraft.
  863. For instance, a high-altitude bomber should be able to pass over a ship
  864. and under a satellite with impunity.
  865. In general, you define the ``operating altitudes'' of a unit, so in the
  866. example above, you could say that a ship is always at the surface,
  867. bombers operate at 1-10 km, and satellites at 100-10,000 km.
  868. If a unit has more than one operating level, then it can move up and down
  869. by normal movement actions.
  870. Also, most details such as speed and material consumption are the
  871. same for a unit at any altitude.  (Yes, such things vary in real life,
  872. but the effects are usually minor within the unit's normal operating
  873. range.)
  874. Altitudes have a significant effect on combat.
  875. A unit at some altitude can only attack units at a specific range of altitudes
  876. up and down.
  877. Using the example again, you could define fighter aircraft to operate at
  878. 0-20km and be able to attack up and down 5km, while bombers can
  879. attack up to 10km down (i.e. down to the ground), but not up.
  880. Satellites remain invulnerable.
  881. All this applies equally to units underground and undersea.
  882. [need info about setting up other layers]
  883. @node Designing the Sides, Designing the Units, Altitudes and Elevations, Game Design
  884. @section Designing the Sides
  885. Sides represent the players in a game.  They also serve as a repository
  886. of information shared by units, such as technology and knowledge
  887. of the world.
  888. You should first decide how much about the sides will be predefined.
  889. If you're doing Eastern Front scenarios, it's very easy;
  890. you have Russians and Germans and that's it.  If you're doing a
  891. science-fiction empire-building free-for-all, you may not have to 
  892. specify anything more than a random side name generator.
  893. @menu
  894. * Predefined Sides::
  895. * Side Library::
  896. * Limits on Sides::
  897. * Hints on Sides::
  898. @end menu
  899. @node Predefined Sides, Side Library, Designing the Sides, Designing the Sides
  900. @subsection Predefined Sides
  901. For scenarios and similarly-restrictive games, the game design should create
  902. the sides directly, as in this example:
  903. @example
  904. (side (name "Germany") ... (colors "black,gray") ...)
  905. (side (name "Russia") ... (colors "red") ...)
  906. @end example
  907. Since the initialization machinery allows matching any player with
  908. any side, you can get away with being really vague.
  909. This will create four sides but not say anything about them:
  910. @example
  911. (side)
  912. (side)
  913. (side)
  914. (side)
  915. @end example
  916. If you're going to have predefined units on each side, then you should
  917. add an id to each side:
  918. @example
  919. (side 1 (name "Germany") ... (colors "black,gray") ...)
  920. (side 2 (name "Russia") ... (colors "red") ...)
  921. @end example
  922. Instead of @code{1} and @code{2},
  923. you can also use, say, @code{ge} and @code{ru};
  924. ids can be either symbols or numbers.
  925. @node Side Library, Limits on Sides, Predefined Sides, Designing the Sides
  926. @subsection Side Library
  927. If your game design does not predefine all the sides,
  928. you can define a @dfn{side library} using the @code{side-library} variable.
  929. Basically the library is a weighted list of collections of side properties,
  930. each formatted as a side definition.
  931. @i{Xconq} will use this library for any player that is allowed in the
  932. game but who does not have a side already, and select a side with
  933. a probability determined by the weights.
  934. Each item in the library will be used up to a limit that can be specified
  935. with each item;
  936. if the library has been exhausted before all the sides have been created,
  937. then the extra sides will just be assigned general defaults
  938. for their properties.
  939. The side library here makes futuristic sides for players,
  940. making two of the sides most likely, but allowing others as well:
  941. @example
  942. (set side-library '(
  943.   (10 (name "Federation") (adjective "Federation") (class "fed"))
  944.   (10 (name "Klingon Empire") (noun "Klingon") (class "klingon"))
  945.   (5 (noun "Romulan") (class "romulan"))
  946.   ((noun "Ferengi") (class "fed"))
  947.   ((noun "Vulcan") (class "fed"))
  948. @end example
  949. Note that if the game design limits certain unit types to certain sides,
  950. the choice of sides will be more than just a cosmetic issue.
  951. @node Limits on Sides, Hints on Sides, Side Library, Designing the Sides
  952. @subsection Limits on Sides
  953. So that you can put upper and lower bounds on the number of sides in your
  954. game, GDL includes the variables @code{sides-min} and @code{sides-max}.
  955. As you might expect, every game design must allow at least one side.
  956. The upper limit on sides depends on the implementation, but is at least 7.
  957. Large numbers of sides can make a player's life very complicated,
  958. not to mention consuming vast quantities of memory, so you should
  959. try to limit the number of sides as much as possible.
  960. Another important limit is based on the notion of @dfn{side classes}.
  961. Each side can have a side class, and multiple sides can belong to the
  962. same class.
  963. For instance, sides named @code{"Hyperborean"} and @code{"Germanic"}
  964. could both have class @code{"barbarian"}.
  965. The value of side classes is that unit types have a property
  966. @code{possible-sides} that limits which side class(es)
  967. a type can belong to.  This is very important for any game
  968. in which different players should have fundamentally different
  969. sorts of units.  To continue the barbarians example, it is basically
  970. impossible for any barbarian side to have even one Roman legion,
  971. whether by construction, capture, or even surrender.
  972. So you can do something like
  973. @example
  974. (add legion possible-sides "roman")
  975. (side 1 (name "Rome") (class "roman"))
  976. (side 2 (name "Germania") (class "barbarian"))
  977. (side 3 (name "Hyperborea") (class "barbarian"))
  978. @end example
  979. and ensure that Roman legions are always Roman.
  980. @node Hints on Sides, , Limits on Sides, Designing the Sides
  981. @subsection Hints on Sides
  982. Note that players tend to identify with the sides they're playing,
  983. so a game should allow for as much personalization as possible.
  984. On the other hand, some scenarios derive part of their flavor from
  985. predefinitions.  For instance, a scenario with sides named
  986. ``German'' and ``Russian'', with appropriate colors and emblems,
  987. doesn't have quite the same feel when players rename them to ``Subgenii''
  988. and ``Simpsons''.
  989. A side can have a huge amount of state data, such as the current view.
  990. This rarely needs to be included in its entirety; synthesis methods
  991. will usually suffice to set view data correctly.
  992. Since total security is impossible with a predefined world,
  993. setting a side to have only a partial view won't necessarily
  994. be useful to keep players from knowing what that world really looks like.
  995. @node Designing the Units, Setup Miscellany, Designing the Sides, Game Design
  996. @section Designing the Units
  997. Once you've decided how to handle sides in your game,
  998. you can move on to the initial unit setup.
  999. Initial unit setup is very important, since it has a major
  1000. bearing on how the rest of the game will go,
  1001. and can be done in a number of different ways.
  1002. @menu
  1003. * Predefined Units::
  1004. * Making Countries::
  1005. @end menu
  1006. @node Predefined Units, Making Countries, Designing the Units, Designing the Units
  1007. @subsection Predefined Units
  1008. GDL allows you to define everything about every starting unit in the game.
  1009. This is a powerful approach, but requires much preparation.
  1010. An advantage of predefined units is that there are no unpleasant surprises.
  1011. For instance, suppose you designed an empire game with ships and cities,
  1012. but a random setup leaves some players entirely landlocked.
  1013. Not only will those players be @emph{very} unhappy, they might come
  1014. looking for you @i{before} they've calmed down!
  1015. Asking for initial units is pretty easy, you can either type them into
  1016. a file or create them directly, using the appropriate designer tool in
  1017. a game.
  1018. @example
  1019. (city)
  1020. (city 11 12 1)
  1021. (city (n "Brigadoon"))
  1022. (city (@@ 10 10) (n "New York"))
  1023. (city (@@ 20 10) (n "London") (hp 22))
  1024. @end example
  1025. The only info that you absolutely have to supply is the unit's type.
  1026. If the position is missing, the unit will be placed at a random location.
  1027. If the side number/name is missing, the unit will be independent or on the first
  1028. possible side.
  1029. While the type, position, and side of units is important, exact values of the
  1030. other properties are rarely important for a scenario.  Also, a unit with
  1031. fewer filled-in properties can be used in different games.
  1032. For instance, a list of the present-day major cities worldwide
  1033. really needs only name and location for each;
  1034. the game design can fill in everything else.
  1035. One way to do this would be to set up an appropriate
  1036. @code{unit-defaults} just before including the module.
  1037. To make units start inside transports, you need to specify the @code{t#}
  1038. property for the occupant, and have its value be the id number or name
  1039. of some other unit.  Your players may get an error message if the
  1040. occupant is not of an allowed type for the transport to hold.
  1041. @node Making Countries, , Predefined Units, Designing the Units
  1042. @subsection Making Countries
  1043. Despite the advantages of predefining initial units,
  1044. this doesn't help when you want variable groups of units
  1045. to appear in a randomly-generated world.
  1046. Instead, you should use the @code{make-countries} synthesis method.
  1047. The basic idea is that the method picks a good location for each side's
  1048. country, scatters an initial set of units around that location,
  1049. then possibly grows the country outwards.
  1050. You can do anything from small widely-separated countries to an
  1051. interlocking nightmare resembling pre-Bismarck Germany.
  1052. Because of this, and because of the requirement that this
  1053. method generate random setups that are as fair as possible,
  1054. you have a great many parameters to work with.
  1055. These parameters should be tuned carefully - you will probably
  1056. need to generate and study lots of initial setups, especially
  1057. if your parameters constrain the countries very tightly; the method
  1058. cannot backtrack to fix a poor combination of placements.
  1059. The first step in country generation is to select a location for
  1060. each side's country.  The location is a point that is the ``center''
  1061. of the country (the exact value will be unimportant to players,
  1062. and is not used outside this method).  The constraints are that the
  1063. center of each country is farther than @code{country-separation-min}
  1064. from the center of every other country, that the center is within
  1065. @code{country-separation-max} of at least one other country, and that the
  1066. given initial area of the country (as defined by @code{country-radius-min})
  1067. includes numbers of cells of each terrain type bounded by
  1068. @code{country-terrain-min} and @code{country-terrain-max}.
  1069. The reason for the separation constraints is that having countries
  1070. too close together or too far apart can create serious problems.
  1071. Consider the poor soul who gets tightly sandwiched between two enemies,
  1072. thus becoming lunchmeat, ha ha, or the not-quite-so-poor-but-still-unlucky
  1073. player who ends up on the wrong side of a very large world.  (Keep in mind
  1074. that your players may ask for a much larger world than you were thinking
  1075. of when you designed the game.)
  1076. The terrain constraints help you put the country in a reasonable mix of
  1077. terrain.  For instance, if you want to ensure that your countries include
  1078. some land, but be on the coast rather than inland, then you should say that
  1079. the country must have a minimum of 1 sea cell and 1 land cell.  (In practice,
  1080. the values should be higher, so you don't get small islands being used as
  1081. entire countries and lakes being considered the ocean.)  Keep in mind that
  1082. these constraints may be impossible to satisfy, for instance if a particular
  1083. world does not have enough of the sort of terrain that is being required in a
  1084. country.  If the basic placement constraints fail, @i{Xconq} will just pick
  1085. a random location, warn about it, and then leave it up to the players to decide
  1086. on whether to play the game ``as it lies''.
  1087. @example
  1088. ;;; Keep countries close together, but not too close.
  1089. (set country-separation-min 20)
  1090. (set country-separation-max 25)
  1091. @end example
  1092. Once @i{Xconq} has decided on locations for each country, it then places
  1093. the initial stock of units.  You define this initial stock via the
  1094. unit properties @code{start-with} and @code{independent-near-start}.
  1095. The @code{start-with} units start out belonging to the side, while the
  1096. @code{independent-near-start} units are independent.  The locations
  1097. of these units are random within @code{country-radius-min} of the
  1098. center, but are weighted according to the table @code{favored-terrain}.
  1099. This table is very important; it is the percent chance that a unit of a given
  1100. type will be placed in terrain of the given type.  100 is guaranteed to work,
  1101. and 0 is an absolute prohibition.  Since @code{make-countries}
  1102. tries repeatedly to place each @code{start-with} unit until it succeeds,
  1103. then even terrain with a @code{favored-terrain} value of only 10% will get used
  1104. if there is no other choice, so the table affects the distribution of units
  1105. rather than the number that get placed.  If a starting unit cannot
  1106. be placed on any available terrain, but can be an occupant,
  1107. then @i{Xconq} will attempt to put it inside
  1108. some unit already present.  This is a good way to begin a game with
  1109. aircraft at airports rather than in the air.
  1110. The upshot is that all this
  1111. will do a reasonable layout if the parameters are set reasonably.
  1112. If, however, @code{favored-terrain} is never > 0 for the @code{start-with}
  1113. units and the country terrain,
  1114. but there is some other terrain type for which this would work,
  1115. @i{Xconq} will change the terrain.
  1116. If even that doesn't work, the method will fail [or just complain?].
  1117. This example is from the standard @i{Xconq} game:
  1118. @example
  1119. (set country-radius-min 3)
  1120. (add city start-with 1)
  1121. (add town independent-near-start 5)
  1122. (table favored-terrain 0
  1123.   ((town city) plains 100)
  1124.   (town (desert forest mountains) (20 30 20))
  1125. @end example
  1126. The net effect is to give each player one city outright and 5 towns nearby.
  1127. Although created independent, these towns can be easily taken over right at the
  1128. beginning of a game, so they are a kind of ``warmup'' (like the
  1129. pushing of pawns at the beginning of a chess game).  The @code{favored-terrain}
  1130. table allows cities to appear only in plains, while giving more options to
  1131. towns, since they can appear in deserts, forests, and mountains.  Even so,
  1132. towns are 5 times more likely to be in plains, which is reasonable.
  1133. The optional last step in country generation is to grow the countries outwards
  1134. from the initial area.  This is basically a simple simulation of the
  1135. historical forces that give countries their variety of shapes.
  1136. The algorithm works by deciding whether to add to the country each cell
  1137. at each distance from the country's center.  The chance depends on the
  1138. terrain type and whether the cell has
  1139. already been given to another country.  Once a cell has been given to the
  1140. country, then the method decides whether to add a sided or independent unit
  1141. to the cell, or whether to change the side of an existing unit.
  1142. Country growth stops when either the absolute maximum radius has been
  1143. reached, or too few cells have been added to the country, whichever comes
  1144. first.
  1145. This example is from one of the variants of the standard game:
  1146. @example
  1147. (game-module "standard"
  1148.   ...
  1149.   (variants
  1150.    ...
  1151.     ("Large Countries" eval
  1152.      (set country-radius-max 100)
  1153.      )
  1154. @end example
  1155. The resulting effect is to make all the countries border on each directly.
  1156. @node Setup Miscellany, Units and Actions, Designing the Units, Game Design
  1157. @section Setup Miscellany
  1158. This section describes random things.
  1159. @menu
  1160. * Technology::
  1161. * Creating Self-Units::
  1162. @end menu
  1163. @node Technology, Creating Self-Units, Setup Miscellany, Setup Miscellany
  1164. @subsection Technology
  1165. Technology, or tech for short, is useful when technological development
  1166. is important to a game.  There are several ways to use it.
  1167. One use of tech is to track the results of research.
  1168. You do this by setting the initial tech of a side to (say) 0,
  1169. then requiring a certain tech (say 60) in order to build a desired type.
  1170. If a research action adds 1 to a side's tech, then it will
  1171. take 60 research actions to gain the necessary level.
  1172. The number of turns, of course, depending on how many actions
  1173. the researcher can do each turn, and how many researchers
  1174. are available.  So for instance, 10 researching units results
  1175. in the work being done in 6 turns instead.  You can limit this
  1176. schedule acceleration by setting @code{tech-per-turn-max}.
  1177. Another use of tech is to differentiate sides.
  1178. Suppose you want to do a game involving earthlings and space aliens.
  1179. The aliens can have satellites overhead that earthlings don't even
  1180. know are there, they have equipment earthlings couldn't use even if
  1181. they were able to capture it.  However, earth scientists might learn
  1182. something from it.  To do all this, use @code{tech-to-see} and friends.
  1183. Tech is fundamentally tied to unit types.  However, many games have
  1184. a number of unit types that share technology.  For instance, advances
  1185. in bomber technology usually lead to advances in fighter and surveillance
  1186. aircraft.  The @code{tech-crossover} table is available for this purpose.
  1187. @node Creating Self-Units, , Tech, Setup Miscellany
  1188. @subsection Creating Self-Units
  1189. Normally a player runs the side as a whole,
  1190. and all the units on that side are disposable and interchangeable.
  1191. However, you require one unit to represent the player personally
  1192. among the units of the player's side;
  1193. this unit is the @dfn{self-unit}.
  1194. What this means is that if that unit is captured or dies,
  1195. the player loses the game instantly.
  1196. All the other units on the side will behave normally as for losing,
  1197. either going over to the side that captured the player,
  1198. becoming independent, or disbanding.
  1199. The idea is to increase the player's motivation for self-preservation.
  1200. This is useful to introduce a risk of capture, assassination, and so forth.
  1201. It also prevents bizarre and unrealistic strategies in some games.
  1202. For instance, it sometimes happens in empire-building games that players
  1203. end up switching countries, because each captured another's country and
  1204. neglected to defend their own.  If each player got one capital city,
  1205. and that city were to be a self-unit, then the owner would have to defend
  1206. it at all costs!
  1207. To make this happen, you could do something like this:
  1208. @example
  1209. (set self-unit-required true)
  1210. (add capital-city can-be-self true)
  1211. (add capital-city start-with 1)
  1212. @end example
  1213. @node Units and Actions, Movement of Units, Setup Miscellany, Game Design
  1214. @section Units and Actions
  1215. Players can do all kinds of things with their units.  They can push
  1216. the units around, they can make units build things, they can get into fights,
  1217. or they can just let them sit around.
  1218. You as the designer decide which kinds of things make sense in your
  1219. game, then set up the action parameters appropriately.
  1220. Is moving through swamps going to be slow?
  1221. Can a small town build any kind of ship, or just small ones?
  1222. How often can Godzilla breathe fire?
  1223. Now, what the players work with is the interface, which can do all
  1224. kinds of intelligent things -- whatever makes sense for that interface.
  1225. However, no matter what the interface, no matter what kind of play
  1226. automation, player input eventually breaks down into unit actions.
  1227. The set of action types is predefined and can't be changed.
  1228. They are also very primitive.  Each action takes a number of arguments,
  1229. such as the type of unit to build or the location to move to,
  1230. the action just happens and either succeeds or fails on the spot.
  1231. There are no actions that take longer than one turn to complete,
  1232. and a unit can perform only one action at a time.
  1233. This may seem horribly restrictive, but actions are just
  1234. the low-level building blocks;  players rarely see actions directly.
  1235. You have to be aware of them because the game design specifies
  1236. which unit types are capable of which actions.
  1237. Each @i{Xconq} interface will adjust itself to disallow input that
  1238. would result in types of actions that you have prohibited.
  1239. The number of actions that a unit can do in one turn is limited
  1240. by its action points.  A unit with zero action points cannot do anything
  1241. at all.  A unit with lots of action points can do lots of actions,
  1242. unless each action costs many action points.
  1243. You can define the action point cost of each type of action for each
  1244. unit type.  In some cases, the cost will also depend on the action's arguments.
  1245. Acp is actually a little like a bank account,
  1246. since by not doing anything for awhile,
  1247. a unit can accumulate extra acp (up to @code{acp-max}),
  1248. and it can go into debt temporarily, down to @code{acp-min}
  1249. (which may be a negative value).
  1250. A unit in ``action debt'' at the beginning of a turn cannot move
  1251. or do anything else, and must wait for a turn
  1252. when its acp goes positive again.  This can be a simple way to implement
  1253. both fatigued units and units that can do more if they plan for it.
  1254. Actions always include both an actor and an object.  The actor is
  1255. the brains, and that is whose acp gets used up, but the object has the
  1256. action actually happen to it.  This is so animate units (like humans)
  1257. can manipulate inanimate units (like swords).  You enable this by setting
  1258. the acp of the inanimate to zero, but requiring nonzero acp in the various
  1259. @code{acp-to-} tables.
  1260. In most cases, the actor and actee are the same unit.
  1261. @node Movement of Units, Unit Construction, Units and Actions, Game Design
  1262. @section Movement of Units
  1263. Movement is the most important action type.  There are actually two distinct
  1264. types of actions; one to enter a cell, and one to enter a unit.
  1265. Each unit has a speed which is determined at the beginning of the turn
  1266. and determines how many cells it can enter during the turn.
  1267. However, terrain, borders, and other obstacles can consume extra
  1268. movement points.
  1269. @menu
  1270. * Unit Speed::
  1271. * Movement Costs::
  1272. * Entering Transports::
  1273. * Border Slides::
  1274. * Leaving the Area::
  1275. * Free Moves::
  1276. * Zone of Control::
  1277. @end menu
  1278. @node Unit Speed, Movement Costs, Movement of Units, Movement of Units
  1279. @subsection Unit Speed
  1280. Units have a base speed @code{speed} which is the ratio of mp to acp.
  1281. You can set damaged units to move more slowly.
  1282. You can also allow occupants to add to the speed, up to the
  1283. @code{speed-max} limit.
  1284. You can define wind-affected units by defining speed in each direction
  1285. (max-speed only, do others proportionally).  Would need 4 distinct mp costs
  1286. plus a formula to relate to wind strength.  Wind speed defined as "how
  1287. far a particle of air moves in a turn".  Unit examples include balloons,
  1288. dirigibles, sailing ships, floating cities.
  1289. @node Movement Costs, Entering Transports, Unit Speed, Movement of Units
  1290. @subsection Movement Costs
  1291. Typically the cell entry cost will be the most useful to adjust,
  1292. although the departure cost can be useful in representing units
  1293. mired in jungle mud
  1294. and taking a long time to escape onto clear terrain.
  1295. Be aware that complicated entry/exit costs are confusing to players,
  1296. and AIs may not take them into account very well either.
  1297. Using @code{free-mp} helps players use up all their acp.
  1298. @node Entering Transports, Border Slides, Movement Costs, Movement of Units
  1299. @subsection Entering Transports
  1300. Different kinds of transports have different ways for units
  1301. to get on and off.  For instance,
  1302. ships can dock, or use their boats to enable land units to get on and off.
  1303. The tables @code{ferry-on-entry} and @code{ferry-on-departure}
  1304. specify how much terrain units will have to cross on their own.
  1305. [example]
  1306. Observe that enter/leave costs can be used to make one-way trips.
  1307. For instance, paratroops jumping out of a plane should be able
  1308. to leave cheaply, but have an entry cost so high that they can
  1309. only reboard in a later turn.
  1310. @node Border Slides, Leaving the Area, Entering Transports, Movement of Units
  1311. @subsection Border Slides
  1312. One of the problems with @i{Xconq} borders and connections is that
  1313. neither works exactly like a sea strait.  Consider the Straits of
  1314. Gibraltar.  They are so narrow that one can see the other side,
  1315. but nevertheless impose a formidable barrier to landlubbers.
  1316. At the same time, ships can pass through readily, if
  1317. not secretly.  If cells in the world are 60 miles across, then
  1318. making an all-sea cell is a gross exaggeration.
  1319. However, adding a water border only prevents both land and sea movement!
  1320. To get around all this, @i{Xconq} allows a special kind of
  1321. move called a ``border slide''.
  1322. Basically, if both the destination cell and the border whose endpoints
  1323. touch the start and end cells are allowable terrain for a unit,
  1324. then the unit can move to the destination cell in one move.
  1325. However, it incurs a special cost in addition to the normal entry
  1326. and leave costs for the terrain in the two cells (but @i{not} the border
  1327. crossing cost, since the border is not being crossed, exactly).
  1328. This cost is in the table @code{mp-to-traverse}.
  1329. Border sliding should usually be somewhat expensive, both because
  1330. of the distance (the unit ends up two cells away after only one move),
  1331. and because of the real-life difficulties of passing through a narrow
  1332. strait.  Note that border sliding does not escape the units on either
  1333. side of the border, since the unit doing the sliding will still be
  1334. adjacent to the cells on each side of the border it slid through.
  1335. @node Leaving the Area, Free Moves, Border Slides, Movement of Units
  1336. @subsection Leaving the Area
  1337. This feature can be useful in allowing a non-disbandable unit type
  1338. to escape capture or otherwise retire from action.
  1339. @node Free Moves, Zone of Control, Leaving the Area, Movement of Units
  1340. @subsection Free Moves
  1341. This is most useful in emulating some board games,
  1342. or to prevent clever players from exploiting a mess of move costs.
  1343. The default of @code{-1} is the most playable,
  1344. since player will always be able to use all of their mp.
  1345. Otherwise, there may be situations in which a unit has
  1346. a few acp left, but not enough to go anywhere,
  1347. and so they end up being wasted.
  1348. The free move does not actually get subtracted from the unit's acp,
  1349. it just doesn't let lack of acp forbid the move.
  1350. @node Zone of Control, , Free Moves, Movement of Units
  1351. @subsection Zone of Control
  1352. Sometimes a unit can by its presence alone affect the movement of unfriendly
  1353. units in the vicinity, perhaps by requiring them to hide or to move
  1354. carefully in order to pass by, or even to prevent entry altogether.
  1355. This is called the ``zone of control'' or ZOC.
  1356. Exerting a ZOC requires no action, nor any particular capability on
  1357. on the part of the unit exerting the ZOC.  For instance, a toothless
  1358. fort could still cause raiders to sneak by carefully (at least if they
  1359. didn't know that it was toothless).
  1360. @node Unit Construction, Combat Actions, Movement of Units, Game Design
  1361. @section Unit Construction
  1362. Construction is very important to empire-building and similar strategic
  1363. games.  The construction of a unit may involve as many as four different
  1364. kinds of actions.  This is so you can make construction be an expensive
  1365. long-term process.
  1366. The basic construction is unit creation.  A player might have to do
  1367. research and toolup actions in order to prepare for creation, and might
  1368. also have to do completion actions, if the created unit is not ready to use.
  1369. Normally the interface will just have a single "Build <type>" command,
  1370. which then results in a task that issues appropriate actions, so players
  1371. don't necessarily see all these different actions.
  1372. @menu
  1373. * Researching::
  1374. * Tooling Up::
  1375. * Creation::
  1376. * Completion::
  1377. * Repair::
  1378. @end menu
  1379. @node Researching, Tooling Up, Unit Construction, Unit Construction
  1380. @subsection Researching
  1381. Some types of units may be relatively easy to build, once you know how,
  1382. but at the same time that type totally changes the balance of the game.
  1383. The atomic bomb in WWII is the classic example; once it became available,
  1384. everything changed.
  1385. To allow research, set @code{acp-to-research} to 1 or more.
  1386. @node Tooling Up, Creation, Researching, Unit Construction
  1387. @subsection Tooling Up
  1388. Toolup costs are what you use to represent the overhead of changing
  1389. construction.  Quite often it does not need to be set.  Its primary
  1390. use is to encourage players to commit to grand strategy once chosen,
  1391. because the cost of changing would be prohibitive.
  1392. @node Creation, Completion, Tooling Up, Unit Construction
  1393. @subsection Creation
  1394. You enable creation of new units by setting @code{acp-to-create}
  1395. to 1 or more.
  1396. The location of the newly created unit will depend on both the
  1397. types involved and how the interface works, since both @code{create-in}
  1398. and @code{create-at} actions are available.
  1399. For instance, the new unit immediately takes up space,
  1400. so if creating unit is already full, then the interface
  1401. should have issued a @code{create-at} action to put the
  1402. new unit outside the creator but still stacked in the same cell.
  1403. If this is still too restrictive, and you want to allow players
  1404. to create units in nearby cells, you can set @code{create-range}
  1405. to values higher than the default of 0.
  1406. In order to represent the material costs of creation,
  1407. you can set a minimum requirement, via @code{material-to-create},
  1408. and an amount to be consumed, via @code{consumption-on-creation}.
  1409. You could think of @code{material-to-create} as representing
  1410. catalysts or work force, while @code{consumption-on-creation}
  1411. is the raw material that becomes part of the new unit.
  1412. Finally, you can set the @code{supply-on-creation} to have
  1413. @i{new} material created and given to the new unit.
  1414. This is useful for abstract materials (such as ``enthusiasm'')
  1415. that are somehow ubiquitous.  You should be careful with this
  1416. one, because if the new material is transferrable between units,
  1417. then players could collect a stockpile of the material by
  1418. creating units, stealing their supply, and never finishing them.
  1419. @node Completion, Repair, Creation, Unit Construction
  1420. @subsection Completion
  1421. By default, newly created units are complete and ready-to-use.
  1422. This is rarely a good idea in a game design,
  1423. since even 1 acp-per-turn creators can then create
  1424. another brand-new unit on each turn.
  1425. If you're going to allow that, then you
  1426. should include something else to keep players from being swamped by
  1427. overpopulation.  You can set high accident or attrition rates,
  1428. make creation require scarce materials,
  1429. or make the creators be scarce.
  1430. The best way to slow down unit creation is to create incomplete
  1431. units and then require @code{build} actions to finish them.
  1432. Completeness is defined
  1433. in terms of completeness points (cp) that you can set for each
  1434. type.  A build action then just adds to completeness points.
  1435. Incomplete units do in fact exist as units, so for instance they
  1436. can be captured and completed by another side.
  1437. As with creation, you have to set @code{acp-to-build} to
  1438. 1 or more just to enable build actions.
  1439. In order to regulate the rate of completion, you have to
  1440. set the @code{cp-max} of the unit types being constructed,
  1441. which defines the point at which the unit will be complete,
  1442. and then fill in @code{cp-on-creation} and @code{cp-per-build}.
  1443. The most straightforward approach is to set @code{cp-max}
  1444. to be the number of turns you want to have between each unit
  1445. being constructed, then let @code{cp-on-creation} and
  1446. @code{cp-per-build} both be 1.
  1447. You can set @code{build-range} so that several units can
  1448. cooperate to accelerate construction of a unit.
  1449. There are no maximum rate limits set on this, but it's
  1450. unlikely that players will ever be able to achieve much
  1451. acceleration, because of the limit on the distance between
  1452. the builder and the unit.  For instance, the default range
  1453. of 0 implies that multiple builders of a unit have to be in
  1454. the same cell, which may in turn be constrained by stacking
  1455. limits.
  1456. As with creation, you can also set values in @code{material-to-build}
  1457. and @code{consumption-per-build} to govern material requirements
  1458. and usage.
  1459. You can also allow units to complete themselves.  For instance,
  1460. large ships often use part of their soon-to-be crew to help finish
  1461. the last stages of fitting out.  You set this up via @code{cp-to-self-build}
  1462. and @code{cp-per-self-build}.  Since incomplete units are incapable
  1463. of doing any actions, this is a totally automatic process that happens
  1464. at the beginning of each turn.  Self-building and normal building can
  1465. proceed simultaneously, so you can use this to accelerate the final
  1466. stages of construction.
  1467. Finally, newly completed units can have materials created for them,
  1468. as defined by @code{supply-on-creation}.
  1469. @node Repair, , Completion, Unit Construction
  1470. @subsection Repair
  1471. Players' units will inevitably become damaged, whether in combat,
  1472. from accidents, or from other causes.
  1473. There are two ways that units recover hp; either automatically,
  1474. as defined by @code{hp-recovery}, or by the explicit action @code{repair}.
  1475. Automatic recovery is good for that part of damage that a unit can
  1476. fix just by the passage of time.  It's always good for playability, since
  1477. a player just needs to ``rest'' the unit in order for it to get better.
  1478. On the other hand, the decision to repair may need to be a difficult
  1479. one, and impact both tactical and strategic planning.  For instance,
  1480. a badly damaged battleship can choose to go on fighting and risk being
  1481. sunk, or withdraw for repairs and perhaps jeopardize the campaign it is
  1482. supporting.
  1483. In such cases, you can allow explicit repair actions, via the table
  1484. @code{acp-to-repair}.  You can set the repair rate via
  1485. @code{hp-per-repair}.
  1486. You can also specify how healthy the
  1487. repairer must be, via @code{hp-to-repair}.
  1488. Units can repair themselves.
  1489. @node Combat Actions, Unit Manipulation, Unit Construction, Game Design
  1490. @section Combat Actions
  1491. Not all games require fighting.  Races and exploration
  1492. can be lots of fun, and don't require players to be bashing each other.
  1493. However, the excitement of most @i{Xconq} games derives
  1494. from the chances of going up against an opponent directly.
  1495. Combat includes five distinct action types that a player may choose
  1496. from, not counting detonation, and you specify the characteristics
  1497. of each.  ``Attack'' is hand-to-hand with another unit, ``capture''
  1498. attempts to change the side without damaging, ``fire-at'' hits a unit
  1499. without getting entangled, while ``fire-into'' hits everything
  1500. in a targeted cell.
  1501. Finally, ``overrun'' is an attempt to occupy a cell, doing whatever
  1502. combination of attack, capture, and movement is necessary.
  1503. To specify what kinds of battles are possible, you begin by setting
  1504. the @code{hit-chance} of some unit vs another unit to any value
  1505. greater than zero.  A hit probability of zero completely disallows
  1506. attack.  A hit probability of 100 is a guaranteed hit.
  1507. In practice, you will probably need to specify most hit probabilities
  1508. individually.
  1509. [describe mods to hit prob?]
  1510. Next you need to set the damage done by a hit.
  1511. The default value is 1 hp, which is a good starting place
  1512. but not always particularly realistic.
  1513. [describe variation parms]
  1514. As usual, you can define the action point cost of combat,
  1515. via @code{acp-to-attack} and @code{acp-to-defend}.
  1516. The use of separate tables for attacker and defender allows for
  1517. some extra flexibility.  This is important, because sometimes you
  1518. want to allow combat to keep a defender busy and soak up its acp,
  1519. while at other times attempts to engage in combat should be shrugged off.
  1520. Consider battleships vs infantry; although combat between the two
  1521. rarely causes much damage, an attack by a battleship will cause the
  1522. infantry to keep their heads down, and preventing them from doing much else,
  1523. while the return rifle fire is unlikely to disturb the battleship much!
  1524. Describing simple hit probabilities and damage is oftentimes sufficient
  1525. for a game.  It's simple; players can learn the numbers by heart.
  1526. It's more efficient, because there's no need to manage lots of
  1527. ongoing battles.  However, there are endless numbers of situations
  1528. where this basic model is unsatisfactory, so let's move on to the
  1529. available enhancements.
  1530. The basic parameter for the firing actions is @code{range} of the unit,
  1531. which is the greatest reach possible.
  1532. You can also set a @code{range-min}, which is useful for ballistic
  1533. missiles, certain kinds of artillery,
  1534. and magic spells that can't be used for close-in fighting;
  1535. you can't fire at a unit that is less than @code{range-min} cells away.
  1536. Also, you can define how transports and occupants affect each other in
  1537. combat.  The effects can be both positive and negative, and extend both
  1538. from occupants to their transport and from the transport to its occupants.
  1539. The table @code{transport-protection} defines the percentage of hit damage
  1540. (by any unit type) that gets passed through to each occupant.
  1541. If 0, then the transport is perfect protection. If 100, then each occupant
  1542. gets the same hit as the transport did.
  1543. [Ideally, protection is a prorating on a table value from occupant vs attacking
  1544. unit.]
  1545. Note that an occupant cannot be attacked directly from outside its transport.
  1546. If you want to make combat dependent on having a supply of ammo, use the
  1547. tables @code{hits-with} and @code{hit-by}.
  1548. The material type need not be explicitly designated as ammo,
  1549. but both the hitting and hit units must agree that the same type
  1550. is effectual (we assume that the attacking unit is smart enough not to
  1551. use material types that have no effect on the target unit).
  1552. [need a combat-supply usage in addition]
  1553. @menu
  1554. * Multi-Round Battles::
  1555. * Capture::
  1556. * Detonation::
  1557. @end menu
  1558. @node Multi-Round Battles, Capture, Combat Actions, Combat Actions
  1559. @subsection Multi-Round Battles
  1560. [Multi-round battles are not yet available.]
  1561. @c By default, combat actions are basically raids;
  1562. @c one strike and it's all over.
  1563. @c This of course is highly unrealistic, and leads players to
  1564. @c engage in combat far more casually than is realistic.
  1565. @c You make combat more involving by defining commitments to battles.
  1566. @c Basically, units attack by raising their commitment from zero up to some
  1567. @c values, and remain in combat until they die, are captured, or withdraw
  1568. @c by reducing their commitment to zero again.  At the start of each round,
  1569. @c each unit that is participating has the choice of raising or lowering its
  1570. @c commitment to the battle, within bounds that you define.
  1571. @c Note that units in battle don't have to attack, but that they are
  1572. @c prevented from doing other things.  This can be useful not only
  1573. @c for field battles, but sieges (cities have to deal with besiegers),
  1574. @c and wrestling matches.
  1575. @node Capture, Detonation, Multi-Round Battles, Combat Actions
  1576. @subsection Capture
  1577. Capture is both a distinct action type and a possible consequence of
  1578. normal combat.  As an action, it is useful for both ``bloodless''
  1579. captures and the collecting of objects from a dungeon floor.
  1580. To allow explicit attempts to capture, set @code{acp-to-capture}
  1581. to 1 or more.
  1582. Whether the capture attempt is explicit or a consequence of combat,
  1583. its basic probability of success is derived from the table
  1584. @code{capture-chance}.
  1585. If the unit being captured is independent, there is a separate
  1586. table @code{independent-capture-chance}; if its value is the default
  1587. of -1, then the value of @code{capture-chance} will be used instead.
  1588. For capture attempts that are going to succeed, you can allow
  1589. the victim a chance to wreck itself first, by setting @code{scuttle-chance}.
  1590. The main effect of capture is simply to change the side of the
  1591. unit that was captured.  If the unit cannot be on the capturing
  1592. side, then it will vanish instead.  In any case, the occupants
  1593. will also be captured or vanish,
  1594. although you give them a chance to escape first via
  1595. @code{occupant-escape-chance}.  They will also attempt to
  1596. scuttle themselves if possible.
  1597. You can also require a sacrifice from the capturing unit,
  1598. via the table @code{hp-to-garrison}.  This is the number
  1599. of hp that will be taken from the capturing unit.
  1600. You can set it to the unit's @code{hp-max} to make it
  1601. disappear entirely.  Although this table is inspired
  1602. by realism, it can also serve a pragmatic purpose,
  1603. namely to prevent a single unit from capturing an
  1604. entire country without being affected at all!
  1605. You should set this table according to the ``feel''
  1606. you want for the game, since it can have a major
  1607. effect on speed and pacing of the play.
  1608. As with normal combat, the experience of both the
  1609. capturing and captured unit may change.
  1610. For the capturing unit, this is a gain defined by
  1611. @code{cxp-per-capture}, while the effect on the
  1612. capturing unit is set by @code{cxp-on-capture-effect},
  1613. which is a multiplier (defaulting to 100) that may
  1614. increase or decrease experience.  In practice,
  1615. a decrease is more realistic, representing perhaps
  1616. the replacement of ship or airplane crews, although
  1617. a increase might be more appropriate for mercenaries
  1618. whose response to capture is simply to go to work
  1619. for the new bosses!
  1620. @node Detonation, , Capture, Combat Actions
  1621. @subsection Detonation
  1622. Detonation is both a type of action @code{detonate}
  1623. and an automatic behavior.
  1624. Detonation can damage both the detonating unit (though it need not)
  1625. and any units around its point of detonation, which may or may not
  1626. be its location.  You set it up by defining @code{acp-to-detonate}
  1627. to one or more, set @code{hp-per-detonation} to express
  1628. the amount of damage done to the detonating unit,
  1629. then fill in the detonation damage tables
  1630. @code{detonation-damage-at} and @code{detonation-damage-adjacent}
  1631. to say how badly each type of nearby unit will be hit.
  1632. You can define the exact radius of effect via @code{detonation-range}.
  1633. The effects on occupants of nearby units will be adjusted
  1634. according to the same protection/ablation tables as for combat.
  1635. You can also set detonation to trigger on various kinds of events,
  1636. such as damage to the detonating unit (@code{detonate-on-hit},
  1637. death of the detonating units (@code{detonate-on-death}),
  1638. impending capture (@code{detonate-on-capture}),
  1639. and proximity of certain types of units (@code{detonate-on-approach}).
  1640. You can also set a chance that a unit will detonate spontaneously,
  1641. via @code{detonation-accident-chance}.
  1642. In order to model the catastrophic effects of the worst explosives,
  1643. you can set @code{terrain-damage} to indicate how terrain types will
  1644. change.
  1645. A minefield could be implemented by defining a detonating unit that
  1646. loses some small percentage of its hp every time a unit hits it,
  1647. while hitting the other unit automatically.
  1648. A simple trap would auto-detonate only once, then change to
  1649. a ``sprung trap'' type.
  1650. Then the right kind of unit could come along and do a change type
  1651. action to reset it.
  1652. @node Unit Manipulation, Material Manipulation, Combat Actions, Game Design
  1653. @section Unit Manipulation
  1654. The actions in this group are a mixed bag of manipulations.
  1655. If they need to be in your game, then the need will be obvious,
  1656. otherwise they are pretty much optional.
  1657. @menu
  1658. * Transferring Unit Parts::
  1659. * Changing Side::
  1660. * Changing Type::
  1661. * Disbanding::
  1662. @end menu
  1663. @node Transferring Unit Parts, Changing Side, Unit Manipulation, Unit Manipulation
  1664. @subsection Transferring Unit Parts
  1665. Any unit whose @code{parts-max} is greater than the default of 1
  1666. is a multi-part unit, and its hp denotes size rather than amount
  1667. of damage.  Armies and fleets are two kinds of units which can
  1668. be usefully defined as multi-part.
  1669. Players will very often want to merge or detach parts of a multi-part
  1670. unit, and there is an action @code{transfer-part} provided for that.
  1671. You can control the cost of the action by setting @code{acp-to-transfer-part}.
  1672. @node Changing Side, Changing Type, Transferring Unit Parts, Unit Manipulation
  1673. @subsection Changing Side
  1674. Side changing is like capturing, but players can only do it to units
  1675. that they control.
  1676. The action is @code{change-side}, and you enable by setting
  1677. @code{acp-to-change-side} to 1 or more.
  1678. This will also enable side changing for units that cannot normally act.
  1679. Side changing is especially useful for alliances in multi-player games,
  1680. so it should usually be enabled.  On the other hand, it should not be
  1681. too cheap; you should consider what side changing really means in the
  1682. game's context.
  1683. For instance, even in the close British/American alliance during WWII,
  1684. armies never actually changed sides; British ground units were always
  1685. British, and American ground units always American.  On the other hand,
  1686. ships and bases could be traded back and forth with only a cost in
  1687. time and expense.
  1688. @node Changing Type, Disbanding, Changing Side, Unit Manipulation
  1689. @subsection Changing Type
  1690. In some games, it will be useful to have a notion of promotion
  1691. or upgrade for units.  You can implement this by allowing players
  1692. to do a @code{change-type} action.
  1693. You enable this via the @code{acp-to-change-type} table.
  1694. @node Disbanding, , Changing Type, Unit Manipulation
  1695. @subsection Disbanding
  1696. Sometimes a player will want to get rid of a unit,
  1697. perhaps because some type has been overproduced and is tying up
  1698. valuable resources, or to prevent it from falling into enemy hands.
  1699. You can allow this by setting @code{acp-to-disband} to 1 or more.
  1700. You can control the rate of disbanding with @code{hp-per-disband}.
  1701. You may, for instance, want to allow the deliberate destruction
  1702. of large units, such as battleships, but you don't necessarily want
  1703. disbanding to be a convenient way of preventing their capture.
  1704. Setting @code{hp-to-disband} so as to require several turns to
  1705. get rid of a unit will accomplish this.
  1706. The table @code{supply-per-disband} will allow you to govern the
  1707. rate of recovery of the unit's supplies during the disbanding process.
  1708. It is also possible to make disbanding a way to recover materials
  1709. that were consumed in the construction of the unit, by using the
  1710. table @code{recycleable-material}.  Care should be taken that creation
  1711. and disbanding of units is not a convenient way to manufacture lots
  1712. of a material; players @i{will} use the loophole if it exists!
  1713. It should usually not be possible to disband something large like a city,
  1714. otherwise a clever player might try to eliminate it as a strategic target,
  1715. but most mobile units should be easily disbanded.
  1716. This is especially helpful in an ``construction spiral'' game, where
  1717. the winning player(s) can accumulate large numbers of useless units.
  1718. @node Material Manipulation, Terrain Manipulation, Unit Manipulation, Game Design
  1719. @section Material Manipulation
  1720. You can allow players to produce materials by explicit action,
  1721. and you can control how they transfer materials between units.
  1722. Note that you can usually have a reasonable game without requiring
  1723. all the players to become shipping clerks.  The automated production
  1724. and transfer parameters (see xxx) are almost always sufficient for
  1725. a game.  Explicit action should be limited to games where material
  1726. limitations are so severe that they impact strategy directly,
  1727. and players have to make hard choices between producing materials
  1728. and doing other actions, on a turn-by-turn basis.
  1729. You can define ``stevedore'' units by setting both rate and acp such that
  1730. the u1 -> stevedore -> u2 transfer is faster and cheaper
  1731. than the basic u1 -> u2 rate.
  1732. Then players can use the stevedores to speed up transfers.
  1733. @node Terrain Manipulation, Vision, Material Manipulation, Game Design
  1734. @section Terrain Manipulation
  1735. In a few games, you will want to let players alter the terrain.
  1736. This needs to be done judiciously,
  1737. since a cell of terrain generally represents a vast area,
  1738. and the simulated time in @i{Xconq} is generally too short
  1739. for major terraforming operations.
  1740. However, building bridges and digging moats can be reasonable
  1741. additions to a game.
  1742. Since actions are always completed quickly,
  1743. and there is no concept of ``partly modified terrain'',
  1744. you will probably have to come up with a trick to make terrain modification
  1745. be slow.  One way is make the acp (or material?) cost very high.
  1746. Another way is to make the alteration happen by removing a material,
  1747. such as clearcutting a forest, then letting the action make the
  1748. actual change to clear terrain.
  1749. @node Vision, Backdrop Weather, Terrain Manipulation, Game Design
  1750. @section Vision
  1751. Vision is an important part of @i{Xconq}.
  1752. Information need not come for free in your game design,
  1753. and you can design the parameters to control how much players can get.
  1754. The possibilities range from total knowledge as in board games,
  1755. where nothing is secret except the enemy's heart,
  1756. to games where much of the play hinges on who knows what, and when.
  1757. @menu
  1758. * Seeing All::
  1759. * Coverage::
  1760. * Initial View::
  1761. * Vision Range::
  1762. @end menu
  1763. @node Seeing All, Coverage, Vision, Vision
  1764. @subsection Seeing All
  1765. The simplest thing to do is to set @code{see-all} to @code{true}.
  1766. Then every player sees all the terrain, everybody's units, everybody's
  1767. occupants, the whole world and everything in it.
  1768. This makes @i{Xconq} like a conventional video or board game,
  1769. which is sometimes just what you want.
  1770. Also, since the view matches the world, the game is simpler for players,
  1771. who need not concern themselves with possibly out-of-date information.
  1772. Finally, @code{see-all} is more efficient in time and space,
  1773. since the general visibility calculations need never be done or recorded.
  1774. Many games include @code{see-all} as one of their variants.
  1775. You may also find @code{see-all} to be a useful game debugging aid,
  1776. since you can watch what is happening everywhere in the world.
  1777. But, remember that any AIs will most likely adjust their strategy
  1778. and not bother with patrolling or guesswork about the enemy,
  1779. and you won't be able to debug the other viewing parameters either!
  1780. @node Coverage, Initial View, Seeing All, Vision
  1781. @subsection Coverage
  1782. Still, much of the fun in @i{Xconq} is the potential for surprise.
  1783. The theory of visibility in @i{Xconq} is that each side has a
  1784. layer of coverage, which basically just counts the eyeballs looking at
  1785. each cell.  As your units move around, the coverage in each cell
  1786. goes up and down.
  1787. Any cell with a coverage of zero is not currently being viewed
  1788. by any of the side's units.
  1789. The unit property @code{see-always} is useful for units like towns,
  1790. which are unlikely to disappear secretly.
  1791. These two parameters apply recursively, so for instance a city could be
  1792. @code{see-always} and @code{see-occupants},
  1793. while a building in the city is @code{see-always} and not
  1794. @code{see-occupants}, with the net effect that units
  1795. inside a city can be seen by everybody,
  1796. but not when they enter a building.
  1797. @node Initial View, Vision Range, Coverage, Vision
  1798. @subsection Initial View
  1799. The initial view represents the knowledge assumed to have been
  1800. gathered over the period of time preceding the game.
  1801. @i{Xconq} lets you set a radius around each initial unit,
  1802. within which the side knows everything.
  1803. Also, any people on your side view both their cell and all
  1804. the adjacent cells.
  1805. @code{already-seen} should usually be true of things like cities,
  1806. independently of their @code{see-always} setting.
  1807. @node Vision Range, , Initial View, Vision
  1808. @subsection Vision Range
  1809. The default vision range (@code{vision-range}) is 1, which basically
  1810. means that a unit can see into adjacent cells but no further.
  1811. You can set this to higher values, which is useful
  1812. for tactical- and person-level games
  1813. with line-of-sight (LOS) rules [if they ever get implemented].
  1814. You can also set the vision range of a unit to 0, which means that
  1815. it can only see things in its own cell.  However, as a special
  1816. case, when such a unit enters a new cell, @i{Xconq} will show the
  1817. terrain of each adjacent cell, but not any units that might be
  1818. present.  This is so players
  1819. can decide which way to move without having to plunge blindly into
  1820. unknown terrain or do some sort of awkward ``adjacent cell examination''
  1821. action before moving.
  1822. This only provides information about terrain and units that
  1823. are seen if the terrain is seen.
  1824. @node Backdrop Weather, Backdrop Economy, Vision, Game Design
  1825. @section Backdrop Weather
  1826. [The four temperature extremes are independent of each other,
  1827. so you can make higher latitude temperatures vary drastically with the
  1828. season, while equatorial temperatures are much more stable; or vice versa.
  1829. Average temperature usually varies more slowly over some kinds of terrain
  1830. than others.  For instance, oceanic circulation moderates temperature
  1831. swings in terrain that is near open ocean.]
  1832. @node Backdrop Economy, Random Events, Backdrop Weather, Game Design
  1833. @section Backdrop Economy
  1834. Economy in @i{Xconq} means pushing materials around.  So if you want an
  1835. economy in your game design, you have to define at least one type of
  1836. material.  To define the economy, you have to decide where materials
  1837. come from, how they get moved around, and how they get used up.
  1838. @menu
  1839. * Creating Materials::
  1840. * Movement of Materials::
  1841. * Consuming Materials::
  1842. @end menu
  1843. @node Creating Materials, Movement of Materials, Backdrop Economy, Backdrop Economy
  1844. @subsection Creating Materials
  1845. Materials come into existence by being placed in units or terrain
  1846. during setup, by being produced by units or terrain, and by appearing
  1847. in newly-created units.
  1848. @node Movement of Materials, Consuming Materials, Creating Materials, Backdrop Economy
  1849. @subsection Movement of Materials
  1850. Once in existence, players can move materials around by explicit action.
  1851. You can also define automated material movement that uses supply and demand.
  1852. The tables @code{in-length} and @code{out-length} control the distance
  1853. over which materials will move each turn.
  1854. @node Consuming Materials, , Movement of Materials, Backdrop Economy
  1855. @subsection Consuming Materials
  1856. Materials exist to be consumed (unless they are relevant to a scorekeeper).
  1857. You can set how much each kind of action uses, as well as how much is needed
  1858. as a prerequisite, sort of like a catalyst.  You can also set consumption
  1859. due to existence alone, plus what happens to a unit when its supply of a
  1860. material runs out.
  1861. @node Random Events, Designing the Interface, Backdrop Economy, Game Design
  1862. @section Random Events
  1863. What simulation game would be complete without random events?
  1864. Random events are handled somewhat similarly to synthesis methods,
  1865. in that you set the value of the variable @code{random-events}
  1866. to a list of the methods that you want run.
  1867. Note that you must still ensure that the probabilities for the
  1868. events on your list are nonzero!
  1869. Superficially, random events just introduce some unpredictability
  1870. into a game.  However, adding it just for its own sake is not
  1871. a good idea; in the worst case, the game becomes the infamous
  1872. ``dice-rolling contest'', where nothing matters except luck.
  1873. Random events are more valuable when they introduce risk,
  1874. and players have to balance that risk against their goals.
  1875. As an example, random losses of cities in the standard game
  1876. would be pointless, since players have to have them, and there
  1877. would be a chance that all of a player's cities would disappear,
  1878. causing the player to lose for no good reason at all.
  1879. On the other hand, the chance of losing an expensive capital
  1880. ship in shallow coastal waters is enough to motivate the player
  1881. to keep them well out to sea.
  1882. In the past, bugs or unexpected behavior in random event routines
  1883. have resulted in hard-to-reproduce problems.
  1884. For the sake of debugging, you should test the game with random
  1885. event probabilities set very high, perhaps as a variant so it can
  1886. still be played normally.
  1887. @menu
  1888. * Accidents::
  1889. * Attrition::
  1890. * Revolts::
  1891. * Surrenders::
  1892. @end menu
  1893. @node Accidents, Attrition, Random Events, Random Events
  1894. @subsection Accidents
  1895. The name of the accident method is @code{accidents-in-terrain}.
  1896. Accidents should be restricted to definite hazardous situations, to go along
  1897. with movement constraints - for instance, carriers and battleships
  1898. in shallow water should have a small chance to hit a rock and sink.
  1899. You can specify two kinds of accident; a damaging accident,
  1900. which hits the unit as if it were in combat, or a vanishing
  1901. accident, in which the unit disapppears instantly.
  1902. Damaging accidents occur according to the @code{accident-hit-chance}
  1903. table, and damage the unit according to @code{accident-damage}.
  1904. The interpretation of these is similar to their combat counterparts.
  1905. The @code{accident-vanish-chance} table sets the probability for
  1906. the unit to simply vanish without a trace.
  1907. @node Attrition, Revolts, Accidents, Random Events
  1908. @subsection Attrition
  1909. Attrition is a sort of higher-probability/lower-damage type
  1910. of accident.  It is useful for armies in hostile terrain,
  1911. where deserters and casualties slowly reduce its strength.
  1912. Attrition can be useful for ``aging''
  1913. a unit, if you need to keep the unit from being around too long.
  1914. @node Revolts, Surrenders, Attrition, Random Events
  1915. @subsection Revolts
  1916. Revolts are spontaneous changes of side, independent of any
  1917. other consideration.  Since there is no way to protect against
  1918. this, the chance should usually be very small, less than .01;
  1919. even a small chance of will cause players to maintain reserves
  1920. just in case.
  1921. @node Surrenders, , Revolts, Random Events
  1922. @subsection Surrenders
  1923. The method's name is @code{units-surrender}; when it runs, it
  1924. checks each unit to see if it is within @code{surrender-range}
  1925. of a unit on an unfriendly side, and if the @code{surrender-chance}
  1926. occurs, then the unit will change to the side of the other unit.
  1927. Occupants will also evaluate their surrender/scuttle/escape chances,
  1928. and behave accordingly.
  1929. @node Designing the Interface, Designing Text, Random Events, Game Design
  1930. @section Designing the Interface
  1931. So far, the game design machinery has been focused on semantics.
  1932. The other part of the game design defines how it actually appears
  1933. to the players.  This part of the design can be more loosely
  1934. designed, which is good, because you cannot guarantee that your
  1935. game design will only ever be run with a particular interface,
  1936. and there is a wide variety of interfaces.  You could, for instance,
  1937. define an elaborate set of color graphical icons and patterns,
  1938. only to find that most of your players only have black-and-white
  1939. displays.  @i{Xconq} itself will always be able to cope with
  1940. your omissions, but it will be forced to synthesize
  1941. inferior substitutes.
  1942. Game designs have three general categories of interface elements
  1943. that they can specify: text, graphics, and animations.
  1944. Text elements are just strings describing objects and events
  1945. in a readable form, while graphics consist of small icons
  1946. and patterns primarily representing units and terrain.
  1947. Animations are used to illustrate events as they happen,
  1948. and may include sounds.
  1949. @node Designing Text, Designing the Graphics, Designing the Interface, Game Design
  1950. @section Designing Text
  1951. Although @i{Xconq} is primarily a graphical game system,
  1952. it is complex enough that the graphics alone are
  1953. insufficient to describe what is going on.
  1954. All text that players see is issued by @dfn{text generators},
  1955. which are objects that, when given appropriate inputs,
  1956. produce text fragments that can be used by the interface
  1957. to produce a textual display.
  1958. Each text generator has a number of parameters that
  1959. may be used to select one of several rules [etc]
  1960. @menu
  1961. * Describing Objects::
  1962. * Describing Events::
  1963. * Generating Names::
  1964. * Grammar Examples::
  1965. @end menu
  1966. @node Describing Objects, Describing Events, Designing Text, Designing Text
  1967. @subsection Describing Objects
  1968. @node Describing Events, Generating Names, Describing Objects, Designing Text
  1969. @subsection Describing Events
  1970. @node Generating Names, Grammar Examples, Describing Events, Designing Text
  1971. @subsection Generating Names
  1972. One of @i{Xconq}'s special features is its extensive machinery
  1973. for generating names of things.
  1974. You can generate names for sides, units, and geographical features.
  1975. The possibilities range from a simple list
  1976. of strings up to context-free grammars and arbitrary code modules.
  1977. Naming happens throughout the game, as nameable objects are created, but
  1978. is mostly done during initialization.
  1979. @node Grammar Examples, , Generating Names, Designing Text
  1980. @subsection Grammar Examples
  1981. Here is a very simple grammar:
  1982. @example
  1983. (namer (grammar root 40
  1984.   (root (or 1 (the animal in the thing)))
  1985.   (animal (or cat dog sheep))
  1986.   (thing (or hat umbrella fold))
  1987. @end example
  1988. It makes phrases like @code{"the cat in the hat"},
  1989. @code{"the dog in the umbrella"}, and @code{"the sheep in the hat"}.
  1990. This example is more realistic:
  1991. @example
  1992. ;;; German-like place name generator.
  1993. ;;; Conventional combos most common, random syllables rare.
  1994. ;;; Needs more conventional words to combine?
  1995. (namer german-place-names (grammar root 50
  1996.   (root (or 95 (name)
  1997.              5 ("Bad " name)
  1998.              ))
  1999.   (name (or 40 (prefix suffix)
  2000.             20 (both suffix)
  2001.             20 (prefix both)
  2002.              5 (prefix both suffix)
  2003.             10 (syll suffix)
  2004.             10 (prefix syll suffix)
  2005.         ))
  2006.   (prefix (or
  2007.         schwarz blau grun gelb rot roth braun weiss
  2008.         wolf neu alt alten salz hoch uber nieder gross klein
  2009.         west ost nord sud
  2010.         ;; from real names
  2011.         frank dussel chem stras mut
  2012.         ))
  2013.   (suffix (or
  2014.         dorf torf heim holz hof burg stedt haus hausen
  2015.         bruck brueck bach tal thal furt
  2016.         ;; these aren't so great
  2017.         ach ingen nitz
  2018.         ))
  2019.   (both (or
  2020.         feld stadt stein see schwein schloss wasser eisen berg
  2021.         ))
  2022.   ;; Generate random syllables
  2023.   (syll (or 40 (startsyll vowel endsyll) 5 (vowel endsyll)))
  2024.   (startsyll (or 30 startcons 10 startdiph))
  2025.   (startcons (or b k d f g l m n r 5 s 3 t))
  2026.   (startdiph (or bl kl fl gl 5 sl 3 sch 2 schl
  2027.                  br dr kr fr gr 2 schr 3 tr 2 th 2 thr))
  2028.   (vowel (or 6 a ae 2 au 5 e 2 ei 2 ie 6 i 3 o oe 2 u ue))
  2029.   (endsyll (or 4 b 5 l 3 n 4 r 4 t
  2030.                bs ls ns rs ts 3 ch 3 ck
  2031.                lb lck lch lk lz ln lt lth ltz
  2032.                rb rck rch rn rt rth rtz
  2033.                ss sz 2 th tz
  2034.       ))
  2035. @end example
  2036. This generator usually takes normal German words and glues a
  2037. couple together, making names like @code{"Schwarzburg"},
  2038. @code{"Nordbruck"}, and @code{"Bad Salzwasser"},
  2039. but it will occasionally make a completely
  2040. random syllable using common German phonemes, then glue it into a name,
  2041. resulting in names like
  2042. @code{"Biefeld"} and @code{"Salzgloelthach"}.  Yes, that last one
  2043. is unpronounceable even for Germans, but the generator doesn't
  2044. know that!
  2045. Since there is no special handling to ensure non-garbled names,
  2046. it generally does not work particularly well to try to build
  2047. names from vowels and consonants.  Either random selection from
  2048. a list or putting together syllables seems to do better, with
  2049. perhaps a single totally random syllable thrown in.  Don't forget
  2050. that this is a generator, not a recognizer or parser,
  2051. so you don't have to be able to handle
  2052. every possible name; just enough to make an interesting variety.
  2053. Recursive rules, where a symbol expands into a
  2054. sequence mentioning that same symbol, will work, but they are not recommended.
  2055. Although the generator has a builtin
  2056. limiter to keep from looping forever,
  2057. @c and the UGH list is available,  [this is to be changed?]
  2058. in general there is no way to avoid
  2059. getting awful names like @code{"Feldbruckbruckbruck"}.
  2060. Instead, you can just add extra rules, one for each desired length,
  2061. so for instance you have a rule for 2-syllable names, one for 3-syllable
  2062. names, one for 4 syllables, etc.
  2063. Another advantage is that you can set the probability of each 
  2064. length of name separately,
  2065. and thus lower the probability of longer names,
  2066. so that they only appear once in a while
  2067. and you save the poor players from being continuously tongue-tangled!
  2068. @node Designing the Graphics, Game Module Organization, Designing Text, Game Design
  2069. @section Designing the Graphics
  2070. @i{Xconq} is fundamentally a graphical game;
  2071. fortunately, you don't have to do gnarly
  2072. graphics hacking to get the pretty pictures!
  2073. The basic graphics handling is built into the interface
  2074. subroutines of @i{Xconq}.
  2075. What you @i{do} have to do is to choose or design the basic images.
  2076. @i{Xconq} will always attempt to generate
  2077. some sort of default display for your new game design, but it's
  2078. likely to be pretty ugly.  So your goal here is just to make the
  2079. display look good.  First off you should decide about the overall
  2080. appearance.  Do you want things to be generally light or dark?
  2081. Garish or subtle?  Conventional or exotic?  This is a good time
  2082. to cruise the image libraries and to look at the graphics of other
  2083. games.  Sometimes the theme decides a lot for you - how could you
  2084. display anything other than a red star on a Soviet tank?  You also need
  2085. to think about whether you want to concentrate on b/w or color displays,
  2086. although again @i{Xconq} will try to do something reasonable for both.
  2087. You have to choose three sets of images: terrain patterns or images,
  2088. unit icons, and side emblems.  The terrain patterns have to tile properly,
  2089. since they may be used to fill in large areas, while both unit icons
  2090. and side emblems are single icons.  You can optionally choose solid
  2091. colors for terrain, and to ``colorize'' unit icons and side emblems.
  2092. Once you have chosen and specified a set of images, you have to try them
  2093. out in various combinations in real games.  What you'll most likely
  2094. discover is that they don't always mix like you imagined.  That
  2095. cool-looking emblem for a side disappears against the background of
  2096. space, or two unit icons are nearly indistinguishable on the map.
  2097. At this point, you have to start making some choices.
  2098. Either substitute some different images, or design new ones of your
  2099. Color choices are tricky.  Again, the total effect can be quite different
  2100. from what you imagined, plus you should be careful about the variety
  2101. of displays that your game runs on, or you may be getting complaints
  2102. about how your ``olive'' more closely resembles ``puke gray''!
  2103. Here is an example of unit icons:
  2104. @example
  2105. (add (infantry town city) image-name ("soldiers" "town20" "city20"))
  2106. @end example
  2107. In general, an icon name should describe the literal appearance of the image,
  2108. instead of the type that you want it to represent.
  2109. The @code{"soldiers"} icon, for instance, just shows a row of soldiers;
  2110. in one game the icon can be used to represent infantry, in another,
  2111. armies in general, and in another, the national guard.
  2112. There is an @code{"infantry"} image also,
  2113. but it is the standard ``crossed bandoliers'' symbol,
  2114. and is really only sensible for specialized military games.
  2115. Here is an example of a terrain pattern:
  2116. @example
  2117. (terrain-type plains
  2118.   (color "green") (image-name "plains") (char "+")
  2119. @end example
  2120. The @code{"plains"} is defined in @code{lib/terrain.imf}, as basically
  2121. a blank 8x8 tile with two pixels turned on, which textures things
  2122. somewhat:
  2123. @example
  2124. (imf "plains" ((8 8 tile)
  2125.   (color (pixel-size 1) (row-bytes 1)
  2126.    (palette (0 7969 46995 5169) (1 0 25775 4528))
  2127.    "00/40/00/00/00/04/00/00")
  2128.   (mono "00/40/00/00/00/04/00/00")))
  2129. @end example
  2130. For extra fine control on color displays,
  2131. you can also set the colors of unseen terrain
  2132. and the grid separating cells, via the globals @code{grid-color}
  2133. and @code{unseen-color}.
  2134. Note that some display systems (such as the X Window System)
  2135. allow users to customize
  2136. most or all of their colors, so individuals may override your choices.
  2137. Not much you can do about that though!
  2138. @menu
  2139. * Image Format::
  2140. * Image Design Hints::
  2141. @end menu
  2142. @node Image Format, Image Design Hints, Designing the Graphics, Designing the Graphics
  2143. @subsection Image Format
  2144. @example
  2145. (imf "example" ((8 8) (mono "0011223344556677")))
  2146. @end example
  2147. [describe when fleshed out]
  2148. @node Image Design Hints, , Image Format, Designing the Graphics
  2149. @subsection Image Design Hints
  2150. The design of each graphical image can and should be somewhat independent
  2151. of the basic game design;
  2152. this allows for reuse of pictures.
  2153. The first thing you should do is to check the image library on your
  2154. machine.  The image you're looking for may already be there, but perhaps
  2155. under a different name.  Even if you don't find it, you may notice
  2156. an image that is close enough to be a good starting point.
  2157. The @i{Xconq} image library presently includes hundreds of images,
  2158. so the chances are pretty good that you'll find something useful.
  2159. Designing good images and patterns is a specialized and demanding category
  2160. of artwork that I'm not going to go into here.
  2161. My best advice is to learn from the pros,
  2162. and don't be afraid to experiment.
  2163. @node Game Module Organization, Building New Games, Designing the Graphics, Game Design
  2164. @section Game Module Organization
  2165. Each separate file is known as a @dfn{game module} or just @dfn{module}.
  2166. A module has a name, displayed name, an advertising-style blurb, a version,
  2167. and designer notes.
  2168. This is an example of an elaborately-declared game module with no
  2169. actual content:
  2170. @example
  2171. (game-module "foobar"
  2172.   (title "Foo of Bar")
  2173.   (blurb "An exciting game with lots of cliffhanging suspense")
  2174.   (version "1.3")
  2175.   (program-version (>= "7.0.3"))
  2176.   ;; other properties?
  2177.   (complete-game true)
  2178. ;;; contents here
  2179. (game-module (notes (
  2180.   "This is just a sample game."
  2181.   "It's not really as interesting as the blurb makes out."
  2182.   )))
  2183. (game-module (design-notes (
  2184.   "This is commentary addressed to other designers."
  2185.   "Also a good place to mention things to work on."
  2186.   )))
  2187. @end example
  2188. The @code{notes} and @code{design-notes} could have been supplied with the
  2189. first @code{game-module} declaration, but in practice, putting the
  2190. player and designer notes at the end of the file
  2191. keeps them out of the way.
  2192. You can supply any number of @code{game-module} declarations in a file.
  2193. Only the first need include a name.
  2194. The game module format is only loosely structured.
  2195. In general, anything that you might want to reuse or combine
  2196. in different ways should be a separate module.
  2197. Good candidates include text generators and maps of real terrain.
  2198. Unfortunately, they don't always mix-and-match as well as you
  2199. might like!
  2200. The following are the generally preferred module names:
  2201. Terrain-only modules should be named @code{t-}@i{xxx}.
  2202. Lists of units should be named @code{u-}@i{xxx}.
  2203. Name generators should be name @code{ng-}@i{xxx}.
  2204. When supplying a year in the module name, use four digits,
  2205. unless the rest of the name makes the
  2206. century clear (WWII scenarios are pretty much guaranteed to
  2207. be in the 20th century!).
  2208. @node Building New Games, Debugging, Game Module Organization, Game Design
  2209. @section Building New Games
  2210. There are at least three ways to make a new game design:
  2211. use @i{Xconq} commands to ``play'' a game and then save it,
  2212. create and text-edit the text files defining a game,
  2213. or write and run special-purpose programs
  2214. that create games.  A combination of these techniques will likely prove
  2215. the most useful, since each alone has both strengths and weaknesses.
  2216. For instance, text editing may seem like a crude approach,
  2217. but is the only way to produce certain types of scenarios,
  2218. and text editors have many facilities
  2219. (such as regular expression replacement)
  2220. not directly available in @i{Xconq}.
  2221. On the other hand, maintenance of the correct
  2222. transport/occupant relationships between units
  2223. is hard to do while editing text,
  2224. but comes for free when using @i{Xconq} itself.
  2225. @menu
  2226. * Building Scenarios::
  2227. * Designer Mode::
  2228. * Saving Scenarios::
  2229. * Preparing a Game for Use::
  2230. * Installing Scenarios::
  2231. * Safety::
  2232. * Balance and Playtesting::
  2233. * Complexity::
  2234. * Combinations::
  2235. @end menu
  2236. @node Building Scenarios, Designer Mode, Building New Games, Building New Games
  2237. @subsection Building Scenarios
  2238. The easiest way to customize @i{Xconq} is to build a scenario.
  2239. A scenario is basically a saved game from which irrelevant details,
  2240. such as the list of players, has been omitted.  Typically
  2241. this will include tweaking details, removing random irrelevant junk,
  2242. and generally tuning things.
  2243. One way to do this would just be to start a normal game, save it, and
  2244. then dig through the saved game and edit it, since the saved game is itself
  2245. a game module.  Sometimes this is easy, more likely it will be quite hard
  2246. and error-prone.  A better way is available, in the form of ``designer mode''.
  2247. @node Designer Mode, Saving Scenarios, Building Scenarios, Building New Games
  2248. @subsection Designer Mode
  2249. There are two ways to get into designer mode;  one is to start up a game
  2250. with the appropriate option (@code{-design} under Unix), which makes
  2251. every player with a display a designer, the other is to
  2252. switch on a flag after the game has started.
  2253. Being a designer is a property of a side,
  2254. so in theory a game could have a designer and several other human players,
  2255. or even multiple designers (this might be useful in having assistants to
  2256. help with the construction of large scenarios, or just to have displays
  2257. open to each side's view of the scenario).  AIs effectively sit out the
  2258. game while designers are present.
  2259. Designer mode enables an additional set of commands on the menu or map
  2260. control panel, as well as removing some restrictions on the use of
  2261. normal commands.  It also enables more elaborate game saving machinery,
  2262. so you can save only the parts of a game that you want to make into a scenario.
  2263. Modifications to normal commands include the permission to look at and
  2264. do any command on any unit, including independents and units belonging
  2265. to other sides.
  2266. For instance, any unit can be renamed at any time by any designer in the game.
  2267. The modications include the following:
  2268. @itemize @bullet
  2269. @item
  2270. Move commands can put any unit at any destination instantly.
  2271. @item
  2272. Any unit can be put on any side.
  2273. @item
  2274. Any unit can be disbanded instantly.
  2275. @item
  2276. Any terrain can changed to any type.
  2277. @end itemize
  2278. Some interfaces may also provide additional tool palettes and the like.
  2279. @node Saving Scenarios, Preparing a Game for Use, Designer Mode, Building New Games
  2280. @subsection Saving Scenarios
  2281. If you're not in designer mode, then saving the game will save absolutely
  2282. everything.
  2283. In designer mode, the interface should ask you what parts of the game you
  2284. want to save, and what to name the module.
  2285. If you don't save everything, then you should start up another game
  2286. just to confirm that you got what you wanted, @i{before} shutting down the
  2287. @i{Xconq} that you're designing with.
  2288. Sometimes you won't have saved what you thought you did...
  2289. It's also a good idea to keep a backup copy of data,
  2290. especially the indecipherable area layers;
  2291. use the nesting comments @code{ #| |# } around the old stuff,
  2292. only delete when you're sure it's no longer of interest.
  2293. @node Conversion from Xconq 5, Preparing a Game for Use, Saving Scenarios, Building New Games
  2294. @subsection Conversion from Xconq 5
  2295. There are many scenarios extant from the version 5 of @i{Xconq}.
  2296. Many of them are good games despite some of the quirks of version 5
  2297. that they had to work around.
  2298. Converting these scenarios to the new GDL syntax should provide some great
  2299. new modules and at any rate provide a goldmine of ideas for updated @i{Xconq}
  2300. game modules.
  2301. A set of conversion scripts are provided that will help to ease the
  2302. transition from version 5 to version 7, but they won't save you from
  2303. learning the new GDL syntax or features.
  2304. These scripts will NOT generate working games modules, but they will
  2305. generate valid GDL syntax, and thereby spare you much tedium in conversion.
  2306. The first thing to consider is the naming of the files/modules.
  2307. There are already some loose guidelines for naming version 7 game
  2308. modules (@pxref{Game Module Organization}).
  2309. Terrain or worlds should be in modules named @code{t-xxx.g}.
  2310. These are roughly equivalent to version 5 @code{.map} files.  Collections
  2311. of units, such as the cities to populate world maps, should be in
  2312. files named @code{u-xxx.g}, where @code{xxx} generally identifies which
  2313. map they go with in addition to a general identifier (e.g. @code{1942}).
  2314. Name generators are in files of the form @code{ng-xxx.g}, but you probably
  2315. don't know or care about these yet.  And finally, if you are building
  2316. a set of scenarios based on a core set of rules, you should consider a
  2317. naming scheme that will link them all together so that players can
  2318. find them easily.
  2319. Having said all that, let's get on to the conversion.  The conversion
  2320. scripts go somewhat blindly on the assumption that you've split
  2321. everything up in the ``standard'' way.  That is, assuming that you've
  2322. got a spiffy big scenario, that it comes in three parts: a
  2323. period definition, a map and a scenario file.  If not, if you've
  2324. @emph{dared} to combine some of these files, you should split them
  2325. manually before starting the automated part of the conversion.
  2326. Convert the map using @code{map2g}.  You want to use the -o option and your
  2327. new t-something name and the -b with a full pathname to the period
  2328. file that has the terrain type definitions in it.  This allows @code{map2g}
  2329. to set the default base module and the get the appropriate character
  2330. list for creating the map file.  The generated world will have its
  2331. circumference set to match the width of the generated area,
  2332. i.e. it will wrap from side to side.
  2333. This is because all maps are cylindrical in version 5.
  2334. Next, do a pass over the @code{.scn} file with @code{scn2g}.
  2335. Again you should use -o to get the naming the way you want it.
  2336. This should leave you with
  2337. a very pretty set of units and a very rough hack at a set of victory
  2338. conditions (i.e. scorekeepers).  The scorekeepers will need to be
  2339. completely reworked, since they work rather differently in version 7.
  2340. Now the home stretch, convert the @code{.per} file with @code{per2g}.
  2341. Keep an eye on the output.
  2342. If it complains about ``unknown keywords'' then you've
  2343. probably used one of the more obscure features of version 5.  Don't
  2344. panic because your obscurity will be preserved--commented out--in the
  2345. resulting game module.
  2346. Now you have to edit the module and start sorting out the
  2347. bits that @code{per2g} couldn't handle.  Search for occurances of FIX.
  2348. These are lines inserted by @code{per2g} to note places that need
  2349. your attention.
  2350. @code{per2g} may have done nothing to the line except comment it out,
  2351. or it may have done a partial (or partially correct) conversion,
  2352. or it may have done a complete and valid conversion but wishes to call your
  2353. attention to related forms that can be added.
  2354. For this process you are going to need to have the documentation
  2355. close at hand to make sure you get the syntax right.  The best thing
  2356. to do is read thru this chapter of the manual and then have
  2357. the Reference Manual chapter on hand while editing the module.
  2358. Generally the place to start will be the @code{make} and @code{maker}
  2359. lines from the old period definition.
  2360. These are not converted at all by @code{per2g}
  2361. (because the machinery has changed so radically in version 7),
  2362. but are often essential to being able to start up a game.  From there you
  2363. can work your way through the rest of the file with frequent references
  2364. to the manual and occasional test runs.  Check out the debugging tips
  2365. in this chapter.
  2366. @node Preparing a Game for Use, Installing Scenarios, Saving Scenarios, Building New Games
  2367. @subsection Preparing a Game for Use
  2368. Once you've constructed a game, you should bring it to a state where it
  2369. can be given to other @i{Xconq} players.
  2370. I recommend copying a standard software release strategy.
  2371. This means documenting how to play the game, documenting
  2372. how it works internally, removing unused junk and dubious
  2373. features, simplifying where possible, resolving open issues
  2374. if possible, documenting them as known problems if not.
  2375. This gets you to the point of having an ``alpha'' or ``beta''
  2376. version (the terms are not precise!).
  2377. These can be given to other people for testing, but should
  2378. be clearly identified as test versions, because your testers
  2379. may pass copies along to others without you knowing about it.
  2380. After some playtesting (see below), edit your game into its
  2381. final form, call it 1.0 and release it to the world!
  2382. After you release your game, you may get some feedback about
  2383. unanticipated problems.  When you resolve these, and want to
  2384. make a new release, be sure to give it a distinct version number.
  2385. This will be important to deciding whether subsequent complaints
  2386. are about your new release or some older one.
  2387. If you always put the version number into the @code{version}
  2388. property of the @code{game-module} form, then it will be displayed
  2389. to players when they ask for help on the game.
  2390. @node Installing Scenarios, Safety, Preparing a Game for Use, Building New Games
  2391. @subsection Installing Scenarios
  2392. Once the scenario is constructed and saved, you can install it in the library
  2393. and otherwise do as you like with it.
  2394. See the interface documents for platform-specific installation details;
  2395. in general, just copying the files into the @code{lib} directory will suffice.
  2396. @node Safety, Balance and Playtesting, Installing Scenarios, Building New Games
  2397. @subsection Safety
  2398. While generally safe -- @i{Xconq} shouldn't crash while you are designing
  2399. nor upon starting up your scenario -- you can do silly things,
  2400. like loading a submarine with battleships as passengers.
  2401. @i{Xconq} won't complain, but it may behave very strangely.
  2402. For instance, a unit might be able to travel with a transport and leave it,
  2403. but not be able to get back on again.
  2404. One way to test a game is to remove all the scorekeepers and
  2405. make all the players be AI-controlled.  The AI code will then
  2406. act totally randomly, thus exercising parts of your design
  2407. that you may not have thought much about.  A convenient way
  2408. to try out various scorekeepers is to put them in variants,
  2409. then select them upon startup.
  2410. @node Balance and Playtesting, Complexity, Safety, Building New Games
  2411. @subsection Balance and Playtesting
  2412. Scenario design can involve subtle questions of balance which
  2413. will only be revealed by repeated play of the scenario.  Playtesting is
  2414. extremely important, even for simple scenarios!  You should try as many
  2415. combinations of startup options as possible - for instance, the combo
  2416. of two humans and one machine might reveal a peculiarity that is not
  2417. observed in a two-person game.
  2418. You can solve many problems by adding more restrictions.
  2419. Since the scenario is your concept, you are free to make whatever
  2420. decisions are necessary to realize that concept;  if somebody
  2421. complains, they are free to make their own designs.
  2422. Playtesting is also the time when you may have to sacrifice realism
  2423. and favorite theories for playability.  Listen to and watch yourself and your
  2424. testers as the game is played.  For instance, you might have included a city
  2425. out in the boonies, but in the game it never does anybody much good, while
  2426. still requiring some amount of attention regularly.  Lose it.
  2427. Game startup can be confusing to players if they all start out with
  2428. lots of units needing to be told what to do.
  2429. One solution is to put most units on automatic behaviors that expire
  2430. in a turn or two, so that novices gradually hear from all the units,
  2431. while experts can still override right from the outset.
  2432. Another approach is to make units independent and allow them to be
  2433. captured early on.
  2434. Still another approach is to make units come in as reinforcements
  2435. at preset times and locations.
  2436. Although as many of the game parameters as possible are checked,
  2437. there is plenty of room for subtle loopholes.  You should think carefully
  2438. about the consequences of each parameter, being particularly sensitive to
  2439. degenerate winning strategies.  Most common are units that are too powerful,
  2440. too fast,
  2441. or are built so quickly that they overwhelm any opposition.
  2442. Players should always be a little ``hungry'';
  2443. not able to get quite as many
  2444. units or as much material as they would really like.
  2445. @node Complexity, Combinations, Balance and Playtesting, Building New Games
  2446. @subsection Complexity
  2447. Although GDL is a powerful language,
  2448. you should avoid designing a game that is too complex to be humanly playable.
  2449. A single game can literally define
  2450. millions of different parameters, each with a range including 100 to 10,000 
  2451. distinct values.  It is clearly possible to spend many
  2452. years exploring just a single set of these!  For more playable and
  2453. enjoyable games, either pick a single thing to treat in detail,
  2454. or else do everything in a simplified way.
  2455. For instance, if you want elaborate movement and combat rules,
  2456. avoid or even eliminate materials and associated material handling rules.
  2457. Another thing to
  2458. keep in mind is that the introduction of a new type may have far-reaching
  2459. consequences -- for instance, a new unit type will need its interactions
  2460. with @i{all} other unit types defined.
  2461. One approach is to introduce a new type as a
  2462. slight modification of an existing type, then to share most of the definitions.
  2463. Another thing you can do is to put complexity into the variants,
  2464. so players with a taste for punishment can indulge themselves,
  2465. while leaving the basic game as more of a fun thing. 
  2466. @node Combinations, , Complexity, Building New Games
  2467. @subsection Combinations
  2468. Many of the 700-plus game parameters were
  2469. chosen for their ability to combine in interesting ways,
  2470. rather than for obvious usefulness.
  2471. For instance, construction in a city can by default
  2472. generate an infinite stream of units.
  2473. But suppose you want to put a limit on the numbers of that type of unit?
  2474. One way is to define a material that
  2475. is essential for construction of that type, let the builder have an initial
  2476. supply, but provide no way to get more of that material.  When it runs out,
  2477. no more units!
  2478. Another trick is to motivate an activity by making it a
  2479. prerequisite to the basic builtin goal of defeating the other player.
  2480. The age of discovery worked this way.  The kings of that time weren't
  2481. interested in new lands per se;  they wanted exploitable possessions that
  2482. could be used to get gold to buy armies big enough to defeat their neighbors.
  2483. You could describe this situation almost exactly, by making
  2484. gold a material, obtainable only by the discovery and capture of independent
  2485. gold mine units, which are thinly scattered over the world
  2486. and can be found only by careful exploration.
  2487. Be inventive!
  2488. Studying the predefined games should suggest many tricks;
  2489. the ``Problems and Solutions'' section below describes
  2490. even more.
  2491. Be sure to document the trick carefully, or the next time you
  2492. work on the game, you might break it, resulting in unhappy
  2493. players wondering why their usual strategies don't work anymore.
  2494. @node Debugging, Problems and Solutions, Building New Games, Game Design
  2495. @section Debugging
  2496. Completely new game designs usually have a number of bugs.
  2497. There are several stages of trouble that you may encounter.
  2498. First, the @i{Xconq} may fail to read a game module completely.
  2499. It will try to report what happened, but if for instance you
  2500. left out a closing parenthesis, you may get some strange error
  2501. messages.  This is just plain old syntax error trouble.
  2502. Once you've successfuly read in your new game,
  2503. bring up the online help and scan through to see if the values
  2504. present are what you thought.
  2505. Sometimes the reader does not interpret a module in the way
  2506. you thought it would.
  2507. The @code{print} form is useful for debugging at this point;
  2508. it can show you whether a defined symbol has the value you
  2509. thought it did.
  2510. However, the most serious
  2511. problems with games are play balance issues.  Some can be found out by
  2512. watching a machine player attached to a display,
  2513. since its decisions are based on perceived values of the units.
  2514. The most subtle bugs can only be uncovered by extensive play
  2515. interspersed with judicious alteration of parameters.
  2516. I find it useful to play for a while,
  2517. then review and adjust the game parameters all at once,
  2518. thus avoiding tweaking one parameter only to find that it results in
  2519. another being inconsistent.
  2520. Parameters interact in many ways - you should keep this in
  2521. mind when experimenting.
  2522. Something else to keep in mind at this point is that playability should
  2523. outweigh realism.  For example, real-life airplanes can travel 1,000
  2524. times faster than a person walking on the ground, but airplanes that
  2525. could move 1,000 cells in a turn would be ridiculous
  2526. (try it out, @i{Xconq} will let you do this!).
  2527. @node Problems and Solutions, Optimization, Debugging, Game Design
  2528. @section Problems and Solutions
  2529. This section discusses specific kinds of design problems and ways that
  2530. you might solve them in @i{Xconq}.  These are merely suggestions;
  2531. in the past, game designers have come up with all sorts of ingenious ideas.
  2532. If you come up with one yourself, please pass it along!
  2533. @menu
  2534. * Limiting Unit Quantities::
  2535. * Handicapping::
  2536. * Buying the Initial Setup::
  2537. * Leaders::
  2538. * Navigable Rivers::
  2539. * What Ranges for Values?::
  2540. * Fatigue::
  2541. * Brainless Units and Scorekeeping::
  2542. * Days and Years::
  2543. * Xconq 5.x SetProduct::
  2544. @end menu
  2545. @node Limiting Unit Quantities, Handicapping, Problems and Solutions, Problems and Solutions
  2546. @subsection Limiting Unit Quantities
  2547. In some cases you may want to constrain the total number of units in play,
  2548. perhaps because of performance reasons, or because some type tends to
  2549. proliferate more than is desirable, or because your game concept requires
  2550. a hard limit on the number of units.  You have several ways to do this.
  2551. @i{Xconq} does give you several parameters
  2552. that put a simple cap on total numbers, either by unit type or for all
  2553. units, and per side or for all sides together.
  2554. You can also define a material type that is essential to the creation,
  2555. completion, or operation of units, and make that material be hard to come by.
  2556. Iron to make ships, gold to pay armies, or food to feed armies could all
  2557. work this way.  If the only source of the limiting material is an initial
  2558. supply in a starting unit, then this is a hard limit; if production of the
  2559. limiting material is slow, then the limit is softer but still very real.
  2560. Limits on unit quantities have some interesting uses beyond the obvious ones.
  2561. For instance, a
  2562. useful type that is limited to at most a single instance could be a sort of
  2563. ``football'' where the side that has the one unit finds itself being
  2564. chased after by all the other sides trying to get it.
  2565. You could make a WWII-era game with
  2566. ``Oppenheimer'' as the only scientist who knows how to make
  2567. an atomic bomb (I know, it's not realistic), and have the different sides
  2568. trying to kidnap him.
  2569. @node Handicapping, Buying the Initial Setup, Limiting Unit Quantities, Problems and Solutions
  2570. @subsection Handicapping
  2571. Very rarely will the @i{Xconq} players in a game all be at the same skill
  2572. level.  Sometimes this is OK, since weaker players really do learn more
  2573. from their losses than their wins.  However, when the goal is to have fun,
  2574. or when the difference in abilities is extreme, you can balance things out
  2575. in several different ways.
  2576. One simple approach is just to design an imbalanced scenario, document
  2577. it as such, and let players choose the stronger and weaker sides as desired.
  2578. In many cases this should be sufficient; for instance, accurate historical
  2579. simulations.
  2580. The next most simple solution is to set up sides or side classes and
  2581. fill random properties differently.  Weaker players could choose a side with
  2582. more technology or whose class allows more powerful units.  This isn't
  2583. very adjustable, since all the sides and their property values
  2584. have to be predefined.
  2585. To enable the most precise match of player abilities, you can use the
  2586. @code{initial-advantage} property of player objects.  This property is
  2587. a relative value, defaulting to 1, and indicates how strong the initial
  2588. unit setup should be relative to the other players.  For instance,
  2589. if a three-player game includes advantages of 2/3/7, then the second player
  2590. will have three units for each two of the first player while the third
  2591. player (the weakest) will have seven.  The implementation of relative
  2592. advantages is up to game synthesis, so for example the @code{make-countries}
  2593. will adjust all the numbers of initial units to match the requested
  2594. advantages.  Note that this affects only the initial setup, and only
  2595. certain synthesis methods.
  2596. Once a game has started, all sides are always on an equal footing.
  2597. @node Buying the Initial Setup, Leaders, Handicapping, Problems and Solutions
  2598. @subsection Buying the Initial Setup
  2599. A common form of game setup is to give each player a quantity of ``money''
  2600. of some sort, then give them a menu from which to buy things.  The way you
  2601. would implement this in @i{Xconq} is similar to the method for limiting
  2602. unit quantities - make the money be an initial supply of a special material
  2603. type not used for any other purpose.  This initial supply should be given
  2604. to a first unit that each player starts with.  This first unit could be
  2605. something like the adventurer in a fantasy game who starts with a pot of money,
  2606. so the first unit is also the most important one,
  2607. or perhaps a little dummy unit that
  2608. buys the other units and then is of little interest thereafter, sort of like
  2609. the national bank for the player's country.
  2610. Here's an example:
  2611. @example
  2612. (unit-type adventurer
  2613.   (start-with 1)
  2614. (unit-type shop
  2615.   (start-with 1)
  2616. (unit-type sword)
  2617. (unit-type armor)
  2618. (unit-type boat)
  2619. (material-type money)
  2620. (table initial-supply (adventurer money 200))
  2621. (table acp-to-create (shop (sword armor boat) 1))
  2622. (table material-to-create ((sword armor boat) money (20 100 1000)))
  2623. @end example
  2624. The shop can't do anything besides create items when given money.
  2625. The adventurer starts with the money and has to give it to his/her shop,
  2626. then order the shop to create the
  2627. items desired.  The shop will create completed items instantly,
  2628. ready for the adventurer to use.
  2629. Note that this can't be extended to buy extra intrinsic qualities,
  2630. such as hit points or action points.
  2631. @node Leaders, Navigable Rivers, Buying the Initial Setup, Problems and Solutions
  2632. @subsection Leaders
  2633. Some games, particularly wargames set in Napoleonic times or earlier,
  2634. feature the concept of a ``leader'' as the sole individual who can make
  2635. things happen.  Without a general or field marshal, the army won't move.
  2636. Whether or not this is truly realistic, it does have the effect of
  2637. focusing the game on key individuals!
  2638. One way to do this is to make the leader be a self-unit and limit the
  2639. distance of direct control over other unit types.
  2640. Another way is give armies 0 acp and allow leaders to push them around,
  2641. and still another way is to use leaders as occupants
  2642. that add to an army's speed.
  2643. @node Navigable Rivers, What Ranges for Values?, Leaders, Problems and Solutions
  2644. @subsection Navigable Rivers
  2645. The concept of a navigable unbridged river is a real problem for @i{Xconq}.
  2646. Non-navigable rivers are easily done as border terrain,
  2647. and navigable rivers with lots of bridges can be connections
  2648. (since by their nature, connections can never prevent movement).
  2649. But a navigable river that can't be crossed easily is more of a problem.
  2650. One way is to make a chain of adjacent cells of a water terrain type.
  2651. However, this can be quite unrealistic if cells represent large areas,
  2652. say 10-100 km across; you can end up with continents consisting of more
  2653. river than land.  In some cases, you can define a ``river valley''
  2654. terrain type where both vessels and ground units can exist, with the
  2655. river border terrain along just one edge of the valley.
  2656. You can also allow border sliding.  Border sliding allows a ship to pass
  2657. along the length of a border, but it does require the ship to be in
  2658. compatible terrain at both ends of the border.  So define the river
  2659. as a chain of alternating water cells and water borders connecting them
  2660. together.  Then the river acts as a barrier to units wanting to cross,
  2661. while allowing them to see over to the other side,
  2662. and at the same time ships can pass up and down the river freely
  2663. (modulo any ZOC exerted by units on either side).
  2664. @node What Ranges for Values?, Fatigue, Navigable Rivers, Problems and Solutions
  2665. @subsection What Ranges for Values?
  2666. One of the problems that you encounter when defining a lot of interrelated
  2667. units with lots of properties and tables
  2668. is to decide where to start out with the numbers.
  2669. There are a couple ways to get started.
  2670. First, you can start from real-world numbers.  Let's say your game concept
  2671. is based on turns that last about one day, and you want to use worlds
  2672. with cells that are about 10 miles across.  Now a person in good shape
  2673. can walk about 2 miles per hour, or 20 miles in a day, which comes out
  2674. to 2 cells/turn as @code{acp-per-turn} for units on foot.  This allows
  2675. a speed of 1 cell/turn for injured, tired, or overburdened persons, via
  2676. the various speed modifiers.  However, if this same game includes
  2677. automobiles and airplanes, then using the same calculation,
  2678. we get automobiles that can move 60 cells/turn and airplanes that can
  2679. move 600 cells/turn!  The massive disparity in speeds makes for poor
  2680. playing; every turn each airplane will make 300 moves while the foot
  2681. traveller makes 1.  To make the game work, you'd have to make airplanes
  2682. slower (they have to refuel a lot perhaps) or make people faster (nobody
  2683. walks anywhere anymore).  So the real-world numbers approach isn't
  2684. foolproof.
  2685. Another way to go is to start with the smallest values and work up.
  2686. For instance, in the monster game above, you could assume that the mob moves
  2687. the slowest, and give it a speed of 1.  Then you say that the national
  2688. guard should be able to move twice as fast, and give it a speed of 2.
  2689. Then the monster should be able to chase and catch mobs and guards
  2690. that run away, so you give it a speed of 3 or more.  This approach
  2691. is more painstaking, particularly when lots of numbers are involved.
  2692. You can use both approaches together as well, working with real-world
  2693. numbers until they get too weird, then adjust to make relative values
  2694. sensible, then do some more real-world calculations.
  2695. As always, only playtesting is the final arbiter.
  2696. Once the numbers ``feel'' right in a game,
  2697. only the obsessive-compulsives will care about their exact values.
  2698. @node Fatigue, Brainless Units and Scorekeeping, What Ranges for Values?, Problems and Solutions
  2699. @subsection Fatigue
  2700. Players are often unmerciful to their units, moving them nonstop,
  2701. going into battle after battle, never a thought for how tired the
  2702. poor units might be.
  2703. Although @i{Xconq} does not include fatigue as a basic concept, it does
  2704. have several ways to implement the effects of fatigue.
  2705. One way is to use acp debt.  If you allow the acp to go negative during a turn,
  2706. then the player can work the unit really hard for one turn, then it has to
  2707. rest until its acp builds up to positive levels again.  While acp is negative,
  2708. the unit can take no action on its own.  Over a period of
  2709. time, the effect is that of a unit that can only do so much,
  2710. but can exert itself when needed.
  2711. Another way to do fatigue is via a material type, perhaps called
  2712. ``energy'' or ``enthusiasm''.  As an abstract sort of material,
  2713. don't let energy be passed around (unless you want to have ``infectious
  2714. enthusiasm'', might be useful sometimes for leaders and morale builders).
  2715. Units need energy in order to move, and can consume energy faster
  2716. than they produce.  For instance, if a unit has a speed of 3 hexes/turn,
  2717. consumes 2 units of energy per move, and only produces 4 units of energy
  2718. each turn, then on the average the unit will only be able to move 2 hexes
  2719. in each turn, although if it saves up energy, then it can move the full
  2720. 3 hexes.
  2721. Since different kinds of terrain can have differing productivity,
  2722. you can also make some kinds of terrain be more tiring than others.
  2723. A resort hotel unit could also be allowed to transfer energy to its
  2724. residents, restoring them faster than a Motel 6.
  2725. @node Brainless Units and Scorekeeping, Days and Years, Fatigue, Problems and Solutions
  2726. @subsection Brainless Units and Scorekeeping
  2727. One special case to watch out for occurs in games with ``unintelligent''
  2728. units, that is, they have an acp of 0.  If a side loses all of its units
  2729. except for the unintelligent ones, the player will not be able to do
  2730. anything except wait for the game to end.
  2731. This might be OK, for instance if the idea of the game allows
  2732. for a side to own a particular unit, whether or not it can do anything
  2733. with it (perhaps the unit is a fort, and a side can win if it owns the
  2734. fort, even at the cost of all its other units).  Usually, however, the
  2735. side ought to just lose, in which case you will need to define a special
  2736. scorekeeper that requires each side to have at least one of some
  2737. sort of unit with acp > 0, or else it loses.
  2738. @node Days and Years, Xconq 5.x SetProduct, Brainless Units and Scorekeeping, Problems and Solutions
  2739. @subsection Days and Years
  2740. [should go elsewhere]
  2741. The @i{Xconq} world can be made to revolve around its sun and to rotate
  2742. on its axis. [etc]
  2743. To get a realistic hour-by-hour simulation, say
  2744. @example
  2745. (world
  2746.   (day-length 24)
  2747.   (year-length 8766) ; this is 365.25 days
  2748. @end example
  2749. @node Xconq 5.x Setproduct, , Days and Years, Problems and Solutions
  2750. @subsection Xconq 5.x Setproduct
  2751. @i{Xconq} version 5 had a sometimes-useful flag called ``setproduct''
  2752. that could be set to false, with the effect that any attempts to
  2753. @i{change} construction were disabled.  So for instance, a city that
  2754. was set by a scenario to build bombers would then build bombers
  2755. throughout the game.  The advantages were both in realism (retooling
  2756. a factory can be very time-consuming) and in playability (no construction
  2757. planning required).
  2758. To emulate this in version 7, you can set @code{acp-to-toolup}
  2759. to be zero for cities, but at the same time require 1 tp for each
  2760. type that the city can construct.  In the scenario, set the value
  2761. of the city's tooling to be 1 for the one or more types that you
  2762. want it to specialize in (maybe switching between fighters and
  2763. bombers should be possible, but not to submarines).
  2764. Players can then start and stop construction as desired,
  2765. but are limited to only particular types.
  2766. Even captured independent cities can be limited in what they
  2767. can be used to construct.
  2768. @node Optimization, Junk to Describe Better, Problems and Solutions, Game Design
  2769. @section Optimization
  2770. The @code{add} form is very powerful and very useful for making
  2771. groups of objects share some data.  The grouping also helps the
  2772. designer to see how sets of numbers compare to each other.
  2773. In other words, instead of having multiple forms:
  2774. @example
  2775. (unit-type foo
  2776.   ...
  2777.   (acp-per-turn 3)
  2778.   ...)
  2779. (unit-type bar
  2780.   ...
  2781.   (acp-per-turn 49)
  2782.   ...)
  2783. (unit-type baz
  2784.   ...
  2785.   (acp-per-turn 2)
  2786.   ...)
  2787. @end example
  2788. you can say
  2789. @example
  2790. (add (foo bar baz) acp-per-turn (3 49 2))
  2791. @end example
  2792. to get the same effect.
  2793. To get an inheritance-like effect, you can append lists of types
  2794. together, as in
  2795. @example
  2796. (define mammal (dog cat cow))
  2797. (define bird (hawk eagle condor))
  2798. (define animal (append mammal bird fishie))
  2799. @end example
  2800. which results in a list of seven types.  It is possible to append
  2801. different kinds of objects together.
  2802. @node Miscellaneous Tricks and Techniques, Game Design, Optimization, Game Design
  2803. @section Miscellaneous Tricks and Techniques
  2804. An unwanted unit in a shared library file
  2805. could be gotten rid of by matching on id or
  2806. name and then setting hp to 0;
  2807. @code{(unit "Corinth" (hp 0))}, for instance, would eliminate
  2808. Corinth from an ancient Greek game.
  2809. Elevation data, while interesting to include, can take up a lot of space
  2810. and be more detailed than necessary.  The parameters here allow you to
  2811. restrict elevations to a smaller range of values, which will allow
  2812. for more compact encoding and simpler games.
  2813. For instance, a game set in rolling countryside doesn't need a huge
  2814. range of elevations; you could set elevations to range from 0 to 300
  2815. meters, in 30-meter increments.  Then only 4 bits will be needed to
  2816. encode each value, and yet the player will still see reasonable values
  2817. like "150 meters", and formulas for temperature and other elevation
  2818. dependent data will be correct.
  2819. Note that just because a player controls a side doesn't mean that the
  2820. controlled side can be taken out of the game; for one thing, certain
  2821. types of units will not change sides under any circumstances.
  2822. People materials should usually not be directly movable
  2823. between units.
  2824. ZOC should be less than combat range usually,
  2825. since it means that exerter should be able to
  2826. control ground (but could attack further in multiple turns).
  2827. ZOC levels should be only those reachable by the unit.
  2828. With all the costs of moving around,
  2829. it may be that a unit has movement points left, but
  2830. not enough to meet the full cost of a desired move action.
  2831. You can allow player extra movement points to complete the action
  2832. by setting @code{free-mp} to effectively add the needed mp.
  2833. @c [to refman?]
  2834. A hit on a complete unit should reduce by whole cp/hp, otherwise
  2835. it will appear to be incomplete.  @i{Xconq} will not fix this,
  2836. you have to arrange all the numbers yourself, or run the risk
  2837. of player confusion.
  2838. Bases should "anti-protect" aircraft in games involving both, but
  2839. fighters should protect the base.
  2840. Veason temp values of 40, 20, 5, -40 make earthlike.
  2841.